分类: Web开发
2013-02-04 10:39:49
header("Content-type: text/html; charset=utf-8"); (.*)<\/p>/",$string, $out, PREG_PATTERN_ORDER);
$rand = time();
$name = 'zhongtong';//快递名称编号 中通
$id = '123456';//快递单号
$url = "";
//采集html
$ch = curl_init();
$timeout = 10;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$contents = trim(curl_exec($ch));
curl_close($ch);
//获得标题和url
$string = $contents;
//正则匹配
preg_match_all ("/
if(strpos($out[0][1], "建议操作")!=false){
echo "";
}else{
$str="";
//$str.=$out[0][0];
$str.=$out[0][1];
$str.=$out[0][2];
echo $str;
}
?>