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

From: Date: Thu, 29 Jan 2009 21:36:53 +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-287373@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: >> >> >> <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: >> >> >> <http://devel.debian.tamay-dogan.net/rss.php?action=rss&what=crush> >> >> 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. > Or maybe this (can't test now): exec(escapeshellcmd("echo \"$BUILDLOG\" | head -n 11"), $TMP_DATA); -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#287373) next »