国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

解析php通過cookies獲取遠程網頁的指定代碼

2024-05-04 23:11:00
字體:
來源:轉載
供稿:網友

復制代碼 代碼如下:


function Steal($url, $post_data = ""){
//$header[] = "Accept: text/vnd.wap.wml,*.*";
$user_agent = "Mozilla/4.0";
$follow_loc = 1;
$cookie_file ="./tmp/cook.txt";
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_URL, $url);
@curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
@curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
@curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
@curl_setopt($ch, CURLOPT_HEADER, $header);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $follow_loc);
@curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
if (trim($post_data)!= "") {
@curl_setopt($ch, CURLOPT_POST, 1);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$result = @curl_exec($ch);
@curl_close($ch);
return $result;
}
//獲取網頁代碼的方法
function Cut($file,$from,$end){
$message=explode($from,$file);
$message=explode($end,$message[1]);
if ($message[0] == "")
{
$message[0] = "<font color= '#ff0000'>無法獲取內容</font>";
}
return $message[0];
}
//截取代碼的方法

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沾化县| 靖远县| 四会市| 广饶县| 盐津县| 南澳县| 济南市| 施甸县| 临江市| 新昌县| 新巴尔虎左旗| 陇南市| 湖州市| 中阳县| 河间市| 米泉市| 台前县| 阿拉善盟| 蒲城县| 广元市| 临邑县| 荃湾区| 淮阳县| 老河口市| 香河县| 瑞金市| 岱山县| 柯坪县| 津市市| 大荔县| 邵阳市| 瑞昌市| 龙海市| 当涂县| 绥化市| 偏关县| 濮阳县| 五华县| 成都市| 田林县| 扎囊县|