0

Got this cURL php post request to a remote server but it's not working properly:

#$long_value equals a 1400000 bytes string

$array = array(
    'value' => 1,
    'long_value' => $long_value,
);

$array = http_build_query($array);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://domain_name.com/url/to/script.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);    

The point is that it's not giving me any errors (both error_log and curl_error($ch)). It's just that it exceeds the maximum time limit (30 seconds) and if I set this time limit to 300 still same result.

I'm working with PHP7 and post_max_size is 8MB so my questions are:

How can I fix this problem?

And is it related with the length of the string passed as $long_value?

molinet
  • 266
  • 3
  • 14

0 Answers0