Weird problem while reading in a file to an Array
| From: | Michelle Konzack | Date: | Thu, 29 Jan 2009 21:03:16 +0000 |
| Subject: | Weird problem while reading in a file to an Array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-287370@lists.php.net to get a copy of this message | ||
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";
Now try to call:
<http://devel.debian.tamay-dogan.net/rss.php?action=catch&what=crush&name=http://www.emdebian.org/buildd/a/apt/trunk/apt-arm-1233120802.log>
which is working (see array() at the beginning) and:
<http://devel.debian.tamay-dogan.net/rss.php?action=catch&what=crush&name=http://www.emdebian.org/buildd/b/base-passwd/trunk/base-passwd-arm-1221459903.log>
which fales for array() but as you can see in the Web-Browser output,
$BUILDLOG has gotten the file correctly from curl_exec().
So, whats going on here?
Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/> <http://www.can4linux.org/>
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)