21,886
社区成员
发帖
与我相关
我的任务
分享
$param = array(
'college_id'=>$college_id,
'order_id'=>$order_id
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $page);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$info = curl_exec($ch);
if (curl_errno($ch)) {
$this->ajaxReturn('Errno'.curl_error($ch) ,'JSON');
}
curl_close($ch);
ignore_user_abort(true); // 忽略客户端断开
set_time_limit(0); // 设置执行不超时
$urlinfo = parse_url($url);
$host = $urlinfo['host'];
$path = $urlinfo['path'];
$query = isset($param)? http_build_query($param) : '';
$port = 80;
$errno = 0;
$errstr = '';
$timeout = 10;
$fp = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$fp) {
$this->ajaxReturn( $errstr ,'JSON');
} else {
$out = "POST ".$path." HTTP/1.1\r\n";
$out .= "host:".$host."\r\n";
$out .= "content-length:".strlen($query)."\r\n";
$out .= "content-type:application/x-www-form-urlencoded; charset=UTF-8\r\n";
$out .= "connection:close\r\n\r\n";
$out .= $query;
$ret=fputs($fp, $out);
$this->ajaxReturn( $out ,'JSON');
fclose($fp);
}