Home > Article > Backend Development > Use curl to send post request, but prompt 302 FOUND
Code:
Result:
Please give me more advice!
Code:
Result:
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>
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>
You can capture the packet first to see if there is location information in the returned header information. If so, set CURLOPT_FOLLOWLOCATION