I want to make query with PHP CURL on the site: Apple Service and Support Coverage and want to get result with a Serial No/IMEI No (example IMEI: 359209071801769)
.
How can I do this. Any ideas?
With the code below I didn't get any result because I couldn't post the value. Any idea?
<?php
$cookie = "cookie.txt";
if(!$_POST){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://ift.tt/2gpioT1".round((microtime(true) * 1000) - (60*60*3/1000)));
curl_setopt($curl, CURLOPT_REFERER, "http://ift.tt/2fr3eZN");
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie);
$gv = curl_exec($curl);
$sadf = json_decode($gv, true);
echo '<form action="" method="post">';
echo '<img src="data:image/jpeg;base64,'.$sadf["binaryValue"].'" /><br />';
echo 'Type Captcha Code <input type="text" name="captcha" /><br />';
echo 'Type IMEI<input type="text" name="imei" /><br />';
echo '<input type="submit" value="Run" />';
echo '</form>';
curl_close($curl);
}else{
$imei = $_POST["imei"];
$captcha = $_POST["captcha"];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://ift.tt/2fr3eZN");
curl_setopt($curl, CURLOPT_REFERER, "http://ift.tt/2fr3eZN");
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie);
preg_match('#csrfToken\: "(.*?)"#si', curl_exec($curl), $token);
$post = "sno=$imei&ans=$captcha&captchaMode=image&CSRFToken=".$token[1];
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$content = preg_replace("/<head.*>/i", "<head><base href='http://ift.tt/1Rx5qvt' />", curl_exec($curl), 1);
if(curl_exec($curl) === false){
echo 'Curl error: ' . curl_error($curl);
}else{
echo $content;
}
curl_close($curl);
}
?>
Aucun commentaire:
Enregistrer un commentaire