Date: 04/07/05 (PHP Community) Keywords: php, web so i'm studying ways to implement a web interface with an Connected. "; $cmd = "mode reader\r\n"; fwrite( $conn, $cmd ); $lista .= fgets( $conn, 128 ); $lista .= ""; $cmd = "authinfo user $user\r\n"; fwrite( $conn, $cmd ); $lista .= fgets( $conn, 128 ); $lista .= " "; $cmd = "authinfo pass $passwd\r\n"; fwrite( $conn, $cmd ); $lista .= fgets( $conn, 128 ); echo " Authenticated. "; $lista .= ""; $cmd = "list\r\n"; fwrite( $conn, $cmd ); $lista .= fgets( $conn, 128 ); $lista .= " "; $lista .= fgets( $conn, 256 ); $lista .= " newsgroups list"; $alllist = ""; $alllist .= fread( $conn, 20480 ); // couldn't work with: while( !feof ( $conn ) ) because it never // reaches the end of file, because i can't get the whole stream :( $newsgroups = explode("\n", $alllist ); $final_list = Array(); foreach( $newsgroups as $newsgroup ) { $raw = explode( " ", $newsgroup ); $title = $raw[0]; $num_posts = (int) $raw[1]; $dados = Array( "title" => $title, "num_posts" => $num_posts ); array_push( $final_list, $dados ); } echo "if you want more, ask. but if you could help me with this example, i'd be set. like i said, i get 48 newsgroups despite the server giving me over 100. (i've tried using telnet and it works, but through php, nothing) what am i doing wrong? :-\ Source: http://www.livejournal.com/community/php/281112.html
|