结果:

Heim  >  Artikel  >  Backend-Entwicklung  >  用curl发post请求,但是提示302 FOUND

用curl发post请求,但是提示302 FOUND

WBOY
WBOYOriginal
2016-08-18 09:16:101931Durchsuche

代码:
用curl发post请求,但是提示302 FOUND
结果:
用curl发post请求,但是提示302 FOUND
请多指教!

回复内容:

代码:
用curl发post请求,但是提示302 FOUND
结果:
用curl发post请求,但是提示302 FOUND
请多指教!

302是重定向,你没有设置自动重定向,设置一下就行了。

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

没什么好说的,就是302重定向,可能防止外部链接进来的访问。又或者是你没有抓取到真实的地址。

CURLOPT_FOLLOWLOCATION设置false试试看呢

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

可以先抓包看下返回的头信息里面有没有location的信息 有的话设置下CURLOPT_FOLLOWLOCATION

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn