日期:2014-05-16 浏览次数:20805 次
$arrayData = array("name" => "Hagrid", "age" => "36");
$sendJsonData = json_encode($arrayData);
$ch = curl_init('http://127.0.0.1/jietu/test.php');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $sendJsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($sendJsonData))
);
$ret = curl_exec($ch);
if($ret == '00'){
成功了执行的代码;
}elseif($ret == '11'){
登录失败
}