Re: Weird Results from Curl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---- Ray Hauge <ray.hauge.lists@xxxxxxxxx> wrote: 
> Wolf wrote:
> > ---- Ray Hauge <ray.hauge.lists@xxxxxxxxx> wrote: 
> >> Wolf wrote:
> >>> I'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!
> >>> Wolf
> >>>
> >> It 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.
> > 
> > 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!
> > 
> > Wolf
> 
> 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.

Yeah, the interesting thing though was I was getting the information that I needed really out of the result stack, but the format was completely hosed.  Probably because it was essentially trying to read the stream instead of the data.

*GRUMBLE* 

TGIF!!!

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux