如何通过链接获取跳转后的url参数
本帖最后由 bing15 于 2014-09-12 14:27:23 编辑 我有一个链接,
https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxcheckurl?uin=2447168038&sid=06HuH3sMX61oW3Ql&skey=%40crypt_bcc81ca8_5e4f10a91e02160feafddb694ba29185&deviceid=e333050774658970&opcode=2&requrl=https%3A%2F%2Fopen.weixin.qq.com%2Fconnect%2Foauth2%2Fauthorize%3Fappid%3Dwxdb2a2367e10c1ba6%26redirect_uri%3Dhttp%253A%252F%252Fm.lbtest.imixun.com%252Fweixin.php%26response_type%3Dcode%26scope%3Dsnsapi_base%26state%3D123%23wechat_redirect&scene=1&username=wxid_d50xcfkfwuiu12
登录后复制
如何获取到跳转后的url参数,
我这样写都不行
$url = 'https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxcheckurl?uin=2447168038&sid=06HuH3sMX61oW3Ql&skey=%40crypt_bcc81ca8_5e4f10a91e02160feafddb694ba29185&deviceid=e333050774658970&opcode=2&requrl=https%3A%2F%2Fopen.weixin.qq.com%2Fconnect%2Foauth2%2Fauthorize%3Fappid%3Dwxdb2a2367e10c1ba6%26redirect_uri%3Dhttp%253A%252F%252Fm.lbtest.imixun.com%252Fweixin.php%26response_type%3Dcode%26scope%3Dsnsapi_base%26state%3D123%23wechat_redirect&scene=1&username=wxid_d50xcfkfwuiu12';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$content = curl_exec($ch);
echo $content;
登录后复制
------解决思路----------------------你这个 url 能返回什么?
直接浏览器,返回为空页面
curl 自然也不会有返回
https 是需要证书的
如确认不需要证书,则需需要有 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
但也只能得到头
HTTP/1.1 200 OK
Content-Type: text/html; charset=gbk
Cache-Control: no-cache, must-revalidate
Content-Length: 0
------解决思路----------------------