Home  >  Article  >  Backend Development  >  How to solve php request loss problem

How to solve php request loss problem

藏色散人
藏色散人Original
2021-10-25 09:36:362042browse

Solution to lost PHP request: 1. Urlencode the encrypted string before sending it; 2. Set the proxy in curl to the 8888 port of fiddler.

How to solve php request loss problem

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

How to solve the problem of php request loss?

php curl post request is lost' 'Problem

Background:

Use a login-free authorization jump with a friend and found that Authorization fails occasionally. After checking the log, it is found that if the password contains the character ' ', the authorization will fail.

Through packet capture, it was found that when php uses curl to send a request, ' ' will be converted into spaces (The reason is unknown...it is suspected that curl does urldecode processing by default)

The solution is:

First urlencode the encrypted string before sending it.

P.S.

In addition, it seems that the packet capture and decoding of https requests on Linux are not easy to handle. Later, I used fiddler to capture packets on Windows. After setting up to capture https, I found that it was out of the php code. The request still failed to be captured. You need to set the proxy in curl to the 8888 port of fiddler to successfully capture

curl_setopt($ch,CURLOPT_PROXY,'127.0.0.1:8888');

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to solve php request loss problem. For more information, please follow other related articles on the PHP Chinese website!

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