Page 1 of 1

error in reading the rss file

Posted: Wed Oct 18, 2006 5:54 am
by ravi
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
       when I am reading the rss file   from rediff  at " http://www.rediff.com/rss/inrss.xml " in php code that is given below

Code: Select all

<?php
   $url="http://www.rediff.com/rss/inrss.xml";

   preg_match("/^http:\/\/([^\/]+)(.*)$/", $url, $matches);
   $host = $matches[1];
   $uri = $matches[2];

            $request = "GET $uri HTTP/1.0\r\n";
            $request .= "Host: $host\r\n";
            $request .= "User-Agent: localhost/0.1 http://localhost:80/\r\n";
			$request .= "Connection: close\r\n\r\n";
   print("$matches[0]\n................");
   print("$matches[1]\n................");
   print("$matches[2]\n");
   $http = fsockopen($host, 80, $errno, $errstr, 1);
   if (!$http) {
   echo "$errstr ($errno)<br />\n";
    } else {

                fwrite($http, $request);

                
                $response .= fgets($http, 4096);
 
               //    print("$response");
       }
 ?>
then it is giving the following error:
--------------------------------------------------------------

Warning: fsockopen(): unable to connect to http://www.rediff.com:80 in c:\ecko\web\test\welcome.php on line 17
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)


a)what is the solution to access that file
b) actually I have written code according the given example at RSSMix php parser


thanks in advance
ravi


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Oct 18, 2006 11:47 am
by feyd
Are you unable to use file_get_contents()?

Posted: Fri Oct 20, 2006 3:30 am
by ravi
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

<?php
       $str=file_get_contents("http://www.rediff.com/rss/inrss.xml",FALSE,NULL,10,20);
        print("$str");
    ?>
code:

The file_get_contents funtion is giving the same error that is::

a connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

1)I have installed the apache 2.0.58 and php5.x but same error is giving
2) Is there any proxy settings problem( my system proxy address is 172.16.16.3 and port is 8080)

please help me to slove this problem


thanks in advance
ravi


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]