色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

解析php通過cookies獲取遠(yuǎn)程網(wǎng)頁的指定代碼

復(fù)制代碼 代碼如下:
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; 
}
//獲取網(wǎng)頁代碼的方法
function Cut($file,$from,$end){
$message=explode($from,$file);
  $message=explode($end,$message[1]);
if ($message[0] == "")
{
$message[0] = "<font color= '#ff0000'>無法獲取內(nèi)容</font>";
}
  return $message[0];
}
//截取代碼的方法

php技術(shù)解析php通過cookies獲取遠(yuǎn)程網(wǎng)頁的指定代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 吉木萨尔县| 睢宁县| 南丹县| 贡山| 资兴市| 剑川县| 甘德县| 惠州市| 揭东县| 通城县| 印江| 剑河县| 霍山县| 巨鹿县| 株洲县| 景泰县| 天津市| 石首市| 大足县| 高清| 二连浩特市| 离岛区| 安丘市| 胶州市| 蛟河市| 锡林郭勒盟| 丰顺县| 增城市| 定南县| 鸡东县| 大姚县| 西乌珠穆沁旗| 酉阳| 海南省| 田林县| 黎城县| 神池县| 新干县| 原阳县| 梁河县| 丰镇市|