fsockopen() problems, please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
triceron
Forum Newbie
Posts: 2
Joined: Thu Feb 19, 2004 12:49 pm

fsockopen() problems, please help

Post by triceron »

Hi, I wanted to connect to some usenet servers. So I did this:



$ns = fsockopen("news-read2.maxwell.syr.edu", 119, $errno, $errstr);
fputs($ns,"list \r\n");
...
fclose($ns);




but I keep getting this>

Warning: fsockopen(): unable to connect to news-read2.maxwell.syr.edu:119 in /usenet.php on line 93
Warning: fputs(): supplied argument is not a valid stream resource in /usenet.php on line 106
Warning: fclose(): supplied argument is not a valid stream resource in /usenet.php on line 143


the unable to connect is weird, I am trying to connect to a working usenet news server. The one that is used in this script can be easily used in a newsreader software [like outlook express] without errors (download list of newsgroups for example)

what's wrong?
niceguyeddie
Forum Newbie
Posts: 13
Joined: Fri Nov 28, 2003 7:12 am
Location: Westminster, MD

Post by niceguyeddie »

$ns = fsockopen("news://news-read2.maxwell.syr.edu", 119, $errno, $errstr);

work?
triceron
Forum Newbie
Posts: 2
Joined: Thu Feb 19, 2004 12:49 pm

Post by triceron »

niceguyeddie wrote:$ns = fsockopen("news://news-read2.maxwell.syr.edu", 119, $errno, $errstr);

work?
unfortunatelly not.. just one more error

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: host/servname not known in /data/www/triceron/test/examples/news.php.net/usenet.php on line 93

(I tried the ip as well..)
Post Reply