parterburn Posted February 18, 2010 Share Posted February 18, 2010 Need some help...been fighting a CURL request for a while now and can't seem to figure out the issue. The same code is working on different URL's and returning responses as expected so I'm wondering how to get around the issue that this particular URL is giving me. It seems like I've tried using all the Header, Post & Cookie options possible in curl, but maybe not Output of curl_getinfo: Array ( [url] => http://www.reis.com/submarketlookup/index.cfm?event=enterProp [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 0.004341 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 ) Code being used: $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, "http://www.reis.com"); curl_setopt($c, CURLOPT_TIMEOUT, 10); $contents = curl_exec($c); print_r(curl_getinfo($c)); curl_close($c); Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 18, 2010 Share Posted February 18, 2010 Nothing wrong with your code(?) though your $contents is redirecting <head><meta http-equiv="Refresh" content="0; URL=index.cfm"> Array ( [url] => http://www.reis.com/ [content_type] => text/html; charset=UTF-8 [http_code] => 200 [header_size] => 242 [request_size] => 51 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.165 [namelookup_time] => 0 [connect_time] => 0.051 [pretransfer_time] => 0.051 [size_upload] => 0 [size_download] => 88 [speed_download] => 533 [speed_upload] => 0 [download_content_length] => 88 [upload_content_length] => 0 [starttransfer_time] => 0.165 [redirect_time] => 0 ) Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 18, 2010 Share Posted February 18, 2010 I added a followlocation and can get the contents curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE); HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
parterburn Posted February 18, 2010 Author Share Posted February 18, 2010 Same results, even with followlocation in there...I wonder if it has something to do with my server or PHP.INI settings? http://www.sixteenseven.com/reis_test.php $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($c, CURLOPT_URL, "http://www.reis.com"); curl_setopt($c, CURLOPT_TIMEOUT, 10); $contents = curl_exec($c); print_r(curl_getinfo($c)); curl_close($c); echo "<br><br><br><br>"; echo $contents; echo phpinfo(); Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 18, 2010 Share Posted February 18, 2010 You curl is enabled with what it needs to do anything. I'm kinda lost. A couple of suggestions. Add a user-agent. Its possible that the server is locking you out as a bothersome bot after a few to many accesses. If you are using windows do the usual reboot to get rid of any of Billy's gremlins. You could also try turning off your firewall if you have one running. HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
parterburn Posted February 18, 2010 Author Share Posted February 18, 2010 I gave up on the commercial hosting company & starting up the server on macbook with all the same success you were witnessing. Thanks for helping me debug. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.