结果:
Home > Backend Development > PHP Tutorial > Use curl to send post request, but prompt 302 FOUND

Use curl to send post request, but prompt 302 FOUND

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-18 09:16:10
Original
2111 people have browsed it

Code:
Use curl to send post request, but prompt 302 FOUND
Result:
Use curl to send post request, but prompt 302 FOUND
Please give me more advice!

Reply content:

Code:
Use curl to send post request, but prompt 302 FOUND
Result:
Use curl to send post request, but prompt 302 FOUND
Please give me more advice!

302 is redirection. You have not set up automatic redirection. Just set it up.

<code>curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);</code>
Copy after login

There’s nothing to say, it’s just a 302 redirect, which may prevent access from external links. Or maybe you didn't capture the real address.

Set CURLOPT_FOLLOWLOCATION to false and try it

<code>curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); </code>
Copy after login

You can capture the packet first to see if there is location information in the returned header information. If so, set CURLOPT_FOLLOWLOCATION

Related labels:
php
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template