<?php
$url = ‘http://网址’; 购买后,源码里包含可使用的接口
$str_wyc =”嘴角下垂的人,其人性格一般都不太好,处世非常的板滞枯燥乏味,这脸相的人沒有奋发向上的心思状况,都没有活跃的心态去接收身旁所发生的好与坏。嘴角下垂的人观念是非常极点化低沉的,始终是一幅很低沉的心思状况,那样的人给周边的人发生的满是负面心情,与她们往来的人都不简单高兴,那样的人都是较难往来的。”;
$str = str_replace(array(‘。’,’,’,’%’), array(‘ ‘,’ ‘,’ ‘), $str_wyc);
$content = curl_request($url, array(‘wenzhang’=>$str));
echo $content;
//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
function curl_request($url,$post=”,$cookie=”, $returnCookie=0){
if (! extension_loaded(‘curl’)) {
file_exists(‘./ext/php_curl.dll’) && dl(‘php_curl.dll’); // 加载扩展
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, ‘Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)’);
if (ini_get(‘open_basedir’) == ” && strtolower(ini_get(‘safe_mode’)) != ‘on’){
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
}
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_REFERER, “http://XXX”);
if($post) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
}
if($cookie) {
curl_setopt($curl, CURLOPT_COOKIE, $cookie);
}
curl_setopt($curl, CURLOPT_HEADER, $returnCookie);
curl_setopt($curl, CURLOPT_TIMEOUT, 150);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
if (curl_errno($curl)) {
return curl_error($curl);
}
curl_close($curl);
if($returnCookie){
list($header, $body) = explode(“\r\n\r\n”, $data, 2);
preg_match_all(“/Set\-Cookie:([^;]*);/”, $header, $matches);
$info[‘cookie’] = substr($matches[1][0], 1);
$info[‘content’] = $body;
return $info;
}else{
return $data;
}
}
?>
暂无评论内容