FROM:https://evertpot.com/curl-redirect-requestbody/As a good web citizen, I try to always follow redirects. Not just in my browser, where I actually don’t have all that much control over things, but also a consumer of web services.When doing requests with CURL, redirects arenotfollowed by default.<?php$curl=curl_init('http://example.org/someredirect');curl_setopt($curl,CURLOPT_POSTFIELDS,"foo");curl_setopt($curl,CURLOPT_POST,true);curl_exec($curl);?>Assuming the given url actually redirects like this:HTTP/1.1 301 Moved Permanently
Location: /newendpointCurl will automatically just stop.
...
继续阅读
(47)