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

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

復制代碼 代碼如下:
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];
}
//截取代碼的方法

php技術解析php通過cookies獲取遠程網頁的指定代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 博白县| 长子县| 隆子县| 南昌市| 和顺县| 灵川县| 黄冈市| 永泰县| 北安市| 花莲市| 通榆县| 且末县| 合阳县| 文昌市| 濮阳市| 安庆市| 虎林市| 民乐县| 卢氏县| 香格里拉县| 长乐市| 什邡市| 重庆市| 青河县| 石阡县| 孟连| 乌海市| 格尔木市| 临桂县| 剑阁县| 将乐县| 克山县| 涞源县| 七台河市| 武强县| 郎溪县| 宾阳县| 屏山县| 锦屏县| 镇平县| 新蔡县|