Re: Weird problem while reading in a file to an Array

From: Date: Thu, 29 Jan 2009 22:09:00 +0000
Subject: Re: Weird problem while reading in a file to an Array
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-287378@lists.php.net to get a copy of this message
Shawn McKenzie wrote: > Michelle Konzack wrote: >> Hello, >> >> currently I am coding a RSS feeder for the Emdebian buildd-log and for >> testing I use two files: >> >> <|” tÙßýiÖ >> †]O€„http://www.emdebian.org/buildd/a/apt/trunk/apt-arm-1233120802.log> >> >> <http://www.emdebian.org/buildd/b/base-passwd/trunk/base-passwd-arm-1221459903.log> >> >> and if you look into those Build-Logs, the structure is 100% identic. >> >> And now it comes: While the first file is working fine, >> the second fails processing... >> >> The generated RSS feed is here: >> >> <Wûqºü˜Í yݼÛs >> > >> >> And you can see in the second <item> it is empty... :-( >> >> The script starts with: >> >> $HANDLE=curl_init(); >> curl_setopt($HANDLE, CURLOPT_URL, $_GET['name']); >> curl_setopt($HANDLE, CURLOPT_HEADER, 0); >> curl_setopt($HANDLE, CURLOPT_RETURNTRANSFER, 1); >> $BUILDLOG=curl_exec($HANDLE); >> if (curl_errno($HANDLE) != "0") { >> echo 'Curl error: ' . curl_error($HANDLE); >> exit(); >> } >> curl_close($HANDLE); >> >> /* ******************** Parsing the BUILDLOG ******************** */ >> exec("echo \"$BUILDLOG\" |head -n 11", $TMP_DATA); >> >> and to see what happen to $BUILDLOG and array() I have included: >> >> echo "<pre>\n"; >> print_r($TMP_DATA); >> echo "\n"; >> echo >> "######################################################################\n"; >> echo "\n"; >> echo $BUILDLOG; >> echo "</pre>\n"; >> > > exec(escapeshellcmd("echo '$BUILDLOG' | head -n 11"), $TMP_DATA); > > There are quotes or backticks or something in $BUILDLOG. > Actually though, instead of exec() why not something like: $TMP_DATA = explode("\n", $BUILDLOG, 11); -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#287378) next »