Skip to content
Advertisement

Tag: httprequest

AJAX POST request to a PHP server: Invalid request (Malformed HTTP request) on console and net::ERR_EMPTY_RESPONSE on chrome dev tools

I have the files test.html, test.js and test.php in my directory. I am trying to send some data to my backend, which should be dealt with by test.php. I run my server using PHP’s built-in webserver with the command php -S 0.0.0.0:8080 -t test-server/. Here’s a simplified demonstration, whenever I click “submit”, it should send the data to my php

Handling PHP URL and GET requests

I am currently parsing any given url, for example example.com/page/1 or example.com/api/info/1, by exploding the URL: and then accessing its elements in the array like so: But how could I handle (and access via array in the same way) a url that also includes GET elements, such as example.com/page?id=1 or example.com/api/info?=hello ? I am using nginx and trying files like

Best way to manage long-running php script?

I have a PHP script that takes a long time (5-30 minutes) to complete. Just in case it matters, the script is using curl to scrape data from another server. This is the reason it’s taking so long; it has to wait for each page to load before processing it and moving to the next. I want to be able

Advertisement