search
HomeBackend DevelopmentPHP Tutorial怎么通过链接获取跳转后的url参数

如何通过链接获取跳转后的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




------解决思路----------------------
引用:
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;

得设置referer他是通过referer来检测的
------解决思路----------------------
这个url是哪个接口的?
Statement
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
How do you modify data stored in a PHP session?How do you modify data stored in a PHP session?Apr 27, 2025 am 12:23 AM

TomodifydatainaPHPsession,startthesessionwithsession_start(),thenuse$_SESSIONtoset,modify,orremovevariables.1)Startthesession.2)Setormodifysessionvariablesusing$_SESSION.3)Removevariableswithunset().4)Clearallvariableswithsession_unset().5)Destroythe

Give an example of storing an array in a PHP session.Give an example of storing an array in a PHP session.Apr 27, 2025 am 12:20 AM

Arrays can be stored in PHP sessions. 1. Start the session and use session_start(). 2. Create an array and store it in $_SESSION. 3. Retrieve the array through $_SESSION. 4. Optimize session data to improve performance.

How does garbage collection work for PHP sessions?How does garbage collection work for PHP sessions?Apr 27, 2025 am 12:19 AM

PHP session garbage collection is triggered through a probability mechanism to clean up expired session data. 1) Set the trigger probability and session life cycle in the configuration file; 2) You can use cron tasks to optimize high-load applications; 3) You need to balance the garbage collection frequency and performance to avoid data loss.

How can you trace session activity in PHP?How can you trace session activity in PHP?Apr 27, 2025 am 12:10 AM

Tracking user session activities in PHP is implemented through session management. 1) Use session_start() to start the session. 2) Store and access data through the $_SESSION array. 3) Call session_destroy() to end the session. Session tracking is used for user behavior analysis, security monitoring, and performance optimization.

How can you use a database to store PHP session data?How can you use a database to store PHP session data?Apr 27, 2025 am 12:02 AM

Using databases to store PHP session data can improve performance and scalability. 1) Configure MySQL to store session data: Set up the session processor in php.ini or PHP code. 2) Implement custom session processor: define open, close, read, write and other functions to interact with the database. 3) Optimization and best practices: Use indexing, caching, data compression and distributed storage to improve performance.

Explain the concept of a PHP session in simple terms.Explain the concept of a PHP session in simple terms.Apr 26, 2025 am 12:09 AM

PHPsessionstrackuserdataacrossmultiplepagerequestsusingauniqueIDstoredinacookie.Here'showtomanagethemeffectively:1)Startasessionwithsession_start()andstoredatain$_SESSION.2)RegeneratethesessionIDafterloginwithsession_regenerate_id(true)topreventsessi

How do you loop through all the values stored in a PHP session?How do you loop through all the values stored in a PHP session?Apr 26, 2025 am 12:06 AM

In PHP, iterating through session data can be achieved through the following steps: 1. Start the session using session_start(). 2. Iterate through foreach loop through all key-value pairs in the $_SESSION array. 3. When processing complex data structures, use is_array() or is_object() functions and use print_r() to output detailed information. 4. When optimizing traversal, paging can be used to avoid processing large amounts of data at one time. This will help you manage and use PHP session data more efficiently in your actual project.

Explain how to use sessions for user authentication.Explain how to use sessions for user authentication.Apr 26, 2025 am 12:04 AM

The session realizes user authentication through the server-side state management mechanism. 1) Session creation and generation of unique IDs, 2) IDs are passed through cookies, 3) Server stores and accesses session data through IDs, 4) User authentication and status management are realized, improving application security and user experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!