I am trying to access a PHP file (that contains redirect instructions) through Windows cmd using ideviceactivation from libimobiledevice. The file is hosted with GearHost. Before I started getting this error, I would specify the directory of the file in the command prompt and ideviceactivation would access the PHP file and redirect to the specified URL, where another PHP file is hosted and contains actual instructions for the program. However, I can no longer successfully get the redirect file to access the real file without the following error:
Connection #0 to host (redirect file host) left intact
error_message: Failed to connect to (actual file host) port 80:
Timed out<br>error_no: 7
It works perfect if I specify the directory of the real PHP file through the command prompt, but thats not my objective.
Here is the section of my code for the redirect. It uses curl to access the second file:
$_POST['activation-info'] = $data;
$myurl = "http://website.com/secondphpfile";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL , $myurl );
curl_setopt($ch, CURLOPT_RETURNTRANSFER , 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect: 100-continue", "Accept: */*", "Content-Length: ".strlen($_POST['activation-info']), "Content-Type: multipart/form-data; boundary=------------------------0edb00d9406ed52e--------------------------0edb00d9406ed52e"));
curl_setopt($ch, CURLOPT_USERAGENT , "iOS Device Activator
(MobileActivation-20 built on Jan 15 2012 at 19:07:28)" );
curl_setopt($ch, CURLOPT_POST , 0);
curl_setopt($ch, CURLOPT_POSTFIELDS , $_POST['activation-info']);
$xml_response = curl_exec($ch);
if (curl_errno($ch)) {
$error_message = curl_error($ch);
$error_no = curl_errno($ch);
echo "error_message: " . $error_message . "<br>";
echo "error_no: " . $error_no . "<br>";
}
curl_close($ch);
This code is supposed to redirect to the file at the specified $myurl but it returns the error above. Any suggestions would be awesome!
Connection #0 to host (redirect file host) left intact
is not an error. The error is Failed to connect to (actual file host) port 80 : Timed out
, which is curl
's error_no: 7
https://curl.haxx.se/libcurl/c/libcurl-errors.html#CURLECOULDNTCONNECT
Simply, the connection to (actual file host) port 80
timed out