Re: Weird Results from Curl

From: Date: Mon, 03 Mar 2008 16:26:47 +0000
Subject: Re: Weird Results from Curl
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-270861@lists.php.net to get a copy of this message
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?

« previous php.general (#270861) next »