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

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

 



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.
> 
Actually though, instead of exec() why not something like:

$TMP_DATA = explode("\n", $BUILDLOG, 11);

-- 
Thanks!
-Shawn
http://www.spidean.com

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