How to receive JSON data from this website?

304 views Asked by At

please help me to receive josn data from this site, need to make imei check don't know how to get their response. Tried php porxy page, but unsuccessfull

they use this script, but origin don't let me make crossdomain AJAX Thanks for attention

    $.ajax({ type: "POST", url: "http://iphoneimei.info/json/unlock/request" , 
    data: {imei: '012651006507772'} ,
    error:  function() { 
            $("#unlock-msg").html('<span class="red"> Error </span>');
            $("#unlock-loading").hide();
            $("#unlock-main-div").fadeOut("fast");
        },
    success: function(data) {
        alert(data.msg);            
    }
,dataType: "json"});
1

There are 1 answers

2
David Lin On

I would try using CURL:

$urltopost = "http://iphoneimei.info/json/unlock/request";
$datatopost = array (
    "imei" => "012651006507772",
);
$data_string = json_encode($datatopost);
$ch = curl_init ($urltopost);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json',
        'Content-Length: ' . strlen($data_string))
);
$returndata = curl_exec ($ch);

print_r($returndata);

However, the server keep given empty response. I don't know if the server is available for public use like that. Is a authentication token required ?