如何通过链接获取跳转后的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 Nach dem Login kopieren
如何获取到跳转后的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; Nach dem Login kopieren
------解决思路---------------------- 你这个 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
------解决思路---------------------- 引用: Quote: 引用: 你这个 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 在谷歌浏览器中是可以打,IE确实不行 有一个问题,在我的app中去请求微信接口的时候,会报“请在微信客户端打开链接” 我本身就是通过微信进去的啊,怎么还提示这个,下面是代码: $encodeUrl=urlencode('http://m.lbtest.imixun.com');<br /> $url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxdb2a2367e10c1ba6&redirect_uri='.$encodeUrl.'&response_type=code&scope=snsapi_base&state=123#wechat_redirect';<br /> $ch = curl_init();<br /> curl_setopt($ch, CURLOPT_URL, $url);<br /> curl_setopt($ch, CURLOPT_HEADER, true);<br /> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br /> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);<br /> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br /> $content = curl_exec($ch);<br /> echo $content; Nach dem Login kopieren
得设置referer他是通过referer来检测的------解决思路---------------------- 这个url是哪个接口的?