Maybe this is a simple question, but I didn’t find answer in web.
I have remote script that works when I’m opening
http://www.example.com/do_it.php
I can’t include it, cause this page can give fatal errors, can take too long to load.
I need to load that page from php in the fastest and the easyest way.
Now I’m doing
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,$withReturn);
$execute = curl_exec($ch);
But this script get response, so consequently it will take more time than script that returns only headers, or not returns anything.
That is the better way to do it?
If it will help do_it.php is in same server from where I need to call it.
I think the possible solutions for executing the request and not waiting for a response would be to use php.net/curl_multi_exec and then avoid parsing the response. Another approach would be to use sockets, open a connection to the script, write the request then close the connection without readying the response.
A example curl script:
https://github.com/vrana/php-async/blob/master/CurlAsync.php
An example usage of the socket method:
Above example is untested and is provided as a starting point.