Why different cURL platforms output different results? Simple cURL POST request
I'm testing something very simple with curl. I've got a PHP server (7.4.30) from a provider which has a page called: form.php. The form.php contains the following code:
<html>
......
<?php
echo "Name here::: ";
if(isset($_POST['submit'])) {
echo $_POST['name'];
}
?>
......
</html>
All I'm doing is sending post data to this endpoint via:
curl -L http://www.domain.tld/test/form.php -H "Content-Type: application/x-www-form-urlencoded" -d "name=Nde&submit=Submit"
All I'm expecting in the output is to see my name I submitted via curl, but it doesn't. I get: "Name here::: " but nothing else.
<body>
Name here:::
</body>
</html>
When I run the exact same curl command via reqbin.com/curl, it does exactly what I want, showing the name in the html content output.
<body>
Name here::: Nde
</body>
</html>
I also tried via Git Bash, but it returns the same result as windows curl and I also tried to simulate a POST request via the same server and PHP curl but all seem not to accept my POST data.
I also happen to have another provider and when I do the exact same test on their server, everything works. So it must be something on my provider side, but I have not the faintest idea what the issue could be, given that depending on where I run curl from, it still works.
Does anyone know why I have different results depending on where I run the curl code from?
Thank you
Comments
Post a Comment