0

I've asked about this before but didn't explain myself quite well.

Point is I've been working with cURL post requests and had no problem till now.

I'm trying to send a post request from my remote server:

$file = json_encode($mysqli_select_query);
$file = openssl_encrypt($file, 'AES-256-CBC', $key, 0, $iv);
$file = base64_encode($file);

$file is a select query from database encrypted with openssl_encrypt and then encoded into base64

$array = array(
    'file' => $file,
    'action' => 1,
);

$array = http_build_query($array);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://domain_name.com/absolute/path/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);

but only thing I receive is

PHP Fatal error : Maximum execution time of 30 seconds exceeded

NOTE:

On previous cases what I did was sent a request to local server and retrieving information [mysqli select query] to put into my remote server and it worked well with no errors or warnings.

But know that I'm trying to send information from remote server to local and It's giving me the problems I mentioned before.

Does anyone know how to solve this?

UPDATE:

The Maximum execution time exceeded error line is the same as

$result = curl_exec($ch);

Does this mean that the problem could be on the external script?

molinet
  • 266
  • 3
  • 14
  • 1
    Possible duplicate of https://stackoverflow.com/questions/5164930/fatal-error-maximum-execution-time-of-30-seconds-exceeded – Spangen Jan 11 '18 at 12:13
  • 1
    Possible duplicate of [Fatal error: Maximum execution time of 30 seconds exceeded](https://stackoverflow.com/questions/5164930/fatal-error-maximum-execution-time-of-30-seconds-exceeded) – Spangen Jan 11 '18 at 12:13
  • TL;DR your file is taking longer than 30 seconds to upload, so PHP is killing your script, increase the execution time for your script – Zachary Craig Jan 11 '18 at 12:42
  • How can I do that? @zack6849 – molinet Jan 11 '18 at 12:43
  • 1
    edit php.ini and increase max_execution_time to something higher – Zachary Craig Jan 11 '18 at 12:51
  • @zack6849 thanks! I'll try it later. – molinet Jan 11 '18 at 12:53
  • @zack6849 didn't work. I'm gonna try to send the data as a file.txt and retrieve it on the local server cause I think the main problem is the length of the string pass as post variable... – molinet Jan 11 '18 at 14:47

1 Answers1

0

You should check whether you local or your remote server displays the message and then increase the max_execution_time on that system to some higher value than 30 seconds. I don't think that this is related to cURL in any way

Nico Haase
  • 11,420
  • 35
  • 43
  • 69