他们使用这个脚本,但是起源不让我制作跨域AJAX 感谢您的关注
$.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"});
答案 0 :(得分:0)
我会尝试使用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);
但是,服务器保持给出空响应。我不知道服务器是否可供公众使用。是否需要身份验证令牌?