Home > php教程 > php手册 > php 获取跳转的Url真实地址

php 获取跳转的Url真实地址

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:38:03
Original
1990 people have browsed it

有些页面地址加密需要抓取到他跳转的真是地址这个方法还是不错的。 www.ziqing.cc紫青小说网 标记一下! 无 function curl_post_302($url,$data=null) {$ch = curl_init();curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_URL, $url);

有些页面地址加密 需要抓取到他跳转的真是地址 这个方法还是不错的。

www.ziqing.cc 紫青小说网

标记一下!
function curl_post_302($url,$data=null) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
	curl_setopt($ch, CURLOPT_TIMEOUT, 30);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // 获取转向后的内容 
	$data = curl_exec($ch);
	$Headers = curl_getinfo($ch); 
	curl_close($ch);
	if($data != $Headers){ 
		return $Headers["url"]; 
		}else{
			return false;
		}
}
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template