Post json array through curl getting 404 when large data

Alles, was den Apache betrifft, kann hier besprochen werden.

Post json array through curl getting 404 when large data

Postby pearl123 » 30. January 2022 12:29

Hi All,

I am using apache2.4 Zend server 2019 and PHP 7.3.

I have a local server and I am using public IP to access the local server through the router. I have an array of size 100 indexes when I am sending through curl as JSON array I am getting 404 error. If I decrease the array size to 30 indexes then the same URL works fine and I am getting responses correct.

I have the corrected post max size, set time limit but nothing is working.

One more thing is when I am accessing localhost through postman with large data size its works fine but through public IP we are getting issue

Code: Select all
$array = array();
for($i=0;$i<100;$i++){
  $innerArray = array(
          "ItemNumber"=>"111",
          "StorageLocation"=>"SL1",
          "Quantity"=>"211.600",
          "UOM"=>"KG"
        );
        $array[$i] = $innerArray;
}


  $url = 'http://publicip/projectname/recon.php';

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,100000);
  curl_setopt($ch, CURLOPT_TIMEOUT, 4000000); //timeout in seconds
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($array));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
  $result = curl_exec($ch);
  curl_close($ch);
  echo "<br />";
  echo $result;


Thanks
pearl123
 
Posts: 1
Joined: 30. January 2022 12:20
XAMPP version: 2.4
Operating System: windows server 2019

Return to Apache

Who is online

Users browsing this forum: No registered users and 199 guests