0

I am sending parameters to a PHP file as a POST request, direct from my browser like :

example.com/ with example.php?CID=1

But not getting the values in the PHP file.

I am sending parameters to a PHP file as a POST request, direct from my browser like

in the php file i am trying to read :

$cid = $_POST["CID"];
$cname = $_POST["CNAME"];

But the local variables are null after executing this.

I also tried doing this :

echo var_dump($_POST);

and it returns :

array(0)

i am hosting this on a paid hosting server, and the configuration allows upto 1000 parameters.

DaFois
  • 2,197
  • 8
  • 26
  • 43

2 Answers2

2

The way you have set this up you are using the get method

$cid = $_GET["CID"]; 
$cname = $_GET["CNAME"];

If you are wanting to use post then please read the PHP manual https://www.php.net/manual/en/reserved.variables.post.php

Adam Hull
  • 214
  • 1
  • 8
-2

first of all try this PHP "php://input" vs $_POST

php://input

it will solve your issues and let you process developement as workaround - it is very usefull when communicating with pure json not as jason passed into Post field.

next make a check configuration of your server - i had the same problem with nginx and solved it somehow but do not remember how ;)