Re: Weird Results from Curl
| From: | Ray Hauge | Date: | Fri, 29 Feb 2008 21:42:18 +0000 |
| Subject: | Re: Weird Results from Curl | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270780@lists.php.net to get a copy of this message | ||
Wolf wrote:
---- Ray Hauge <ray.hauge.lists@gmail.com> wrote:CURLOPT_RETURNTRANSFER has gotten me a few times. The default of just outputting the information directly to the browser always seemed a bit odd to me. Maybe that's just because I've only used it for scraping and reading data. -- Ray Hauge www.primateapplications.comWolf wrote:OK, I probably wasn't clear... The results from the server (0 11, 1 11, 0 1, 1 1, 5 Error.... 1, etc) are what I expect them to be, however I can't pull them out. *grumble* I forgot that I commented out the CURLOPT_RETURNTRANSFER line! UGH! Thanks! WolfI'm curling a site to process some data, all well and good but the results are baffling... $result = curl_exec($ch); curl_close($ch); echo "<HR>".gettype ($result); Of course that's not all the code, but the results contain: --------- 0 11 0 1 1 1 1 11 5 An Error Has Occurred During Processing. Error: An Error occured . A message has been sent to the System Administrator with the details of the problem you have encountered. 1 ---- What I can't seem to figure out is what the result type actually is and how to pull just the first piece (0,1,etc) out of the "0 11" that gets returned. I have tried to do a strlen conversion, that failed. I've tried bool converting but it doesn't come across right either. Any ideas? Thanks! WolfIt sounds like the error message is being returned from the remote server. Is gettype() outputting the numbers, or is that part of the output from curl? gettype should be returning a string, so I wouldn't think that gettype would be returning the numbers. Are you using the CURLOPT_RETURNTRANSFER option? If so, then $result would have the text of the site on success, and false on error.