Ben farklı sunucularda yayınları okumak ve ayrıştırmak için küçük bir cronjob üzerinde fsockopen kullanıyorum. Çoğu Geçmişte için, bu çok iyi çalışıyor. Oysa bazı sunucularda, ben böyle, yanıt çok garip çizgiler:
<language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> 11 <item> <title> 1f July 8th, 2010</title> <link> 32 http://darkencomic.com/?p=2406</link> <comments> 3e
Ama ben mesela yılında yem açtığınızda notepad + +, bu göstererek, gayet güzel çalışıyor:
<language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item> <title>July 8th, 2010</title> <link>http://darkencomic.com/?p=2406</link> <comments>
...just to show an excerpt. So, am I doing anything wrong here or is this beyond my control? I'm grateful for any idea to fix this. Here's part of the code I'm using to retrieve the feeds:
$fp = @fsockopen($url["host"], 80, $errno, $errstr, 5);
if (!$fp) {
throw new UrlException("($errno) $errstr ~~~ on opening ".$url["host"]."");
} else {
$out = "GET ".$path." HTTP/1.1\r\n"
."Host: ".$url["host"]."\r\n"
."Connection: Close\r\n\r\n";
fwrite($fp, $out);
$contents = '';
while (!feof($fp)) {
$contents .= stream_get_contents($fp,128);
}
fclose($fp);