Re: Weird Results from Curl

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

 



On Fri, February 29, 2008 3:20 pm, 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.

The result type of curl_exec should always be string, except when it
fails, when it's FALSE (bool)  (Or maybe it's 0 (int) ??? rtfm)

The error message is not actually part of $result nor gettype.  It is
being spewed out to stderr (pipe 2) and splatted to your terminal
screen  in the middle of stdout (pipe 1) confusing you, perhaps.

I'm not sure where the 0 and 11 bit is coming from, but if you want
the first part only:

$data = (int) $result;

should get only the first portion of the integral result.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


-- 
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