I got 302 error message when requesting a url via PHP curl_exec, but got code 200 when do it manually. What could possibly be the difference that makes the result different?
Suppose I have the following code in the server:
$url = "http://localhost/circle/my_request/susan?confirm_key=c429d674e36ffe1a4f87fd5a17a0200dcfff0884e8bb3801d2a7d559dcc8d8cd1416295160"; $ch = @curl_init($url); @curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Circle)"); @curl_setopt($ch, CURLOPT_TIMEOUT,60); $s = @curl_exec($ch); $curl_info = @curl_getinfo($ch); $http_code = $curl_info['http_code'];
In this case, $http_code == 302, or the requested URL is redirected. But when I put the URL manually to the browser, it didn't do the redirection, and took me to the correct place.
Do I miss anything? How come those 2 requests result differently?
Much appreciated

New Topic/Question
Reply


MultiQuote



|