php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2029 Re: [PHP-DEV] Bug #2001: I can't read news header message.
Submitted: 1999-08-11 05:25 UTC Modified: 1999-08-11 10:57 UTC
From: bjb at dosan dot kangnam dot ac dot kr Assigned:
Status: Closed Package: Other
PHP Version: 3.0.11 OS: Redhat Linux
Private report: No CVE-ID: None
 [1999-08-11 05:25 UTC] bjb at dosan dot kangnam dot ac dot kr
thanks for your response...
but I could't solve the problem.

my source(test)
----------------------------------------------------------------------
<?
// news2.kornet.net connect
  $getline="";
  $handle = fsockopen("news2.kornet.net",119);
  $getline = fgets($handle, 1024);
  $code = explode(" ",$getline);
  
  if (strcmp($code[0], "200") ) {
   fputs($handle,"close\r\n");
   fclose($handle);
   return "connect error( news server )";     // &#48708;&#51221;&#49345;&#49884;
  }

// news group connect
  $newsgroup="han.comp.os.linux";
  fputs($handle,"group $newsgroup\r\n");
  $getline = fgets($handle,1024);
  $code = explode(" ",$getline);
  
  if (strcmp($code[0], "211") ) {
   fputs($handle,"close\r\n");
   fclose($handle);
   return group;     // connect error (group)
  }

  fputs($handle,"article\r\n");
  $getline = fgets($handle, 1024);
  $code = explode(" ",$getline); 
  
  if( strcmp($code[0], "220") ) { 
    fputs($handle,"close\r\n");
    fclose($handle);
    return article;     
  }
  
  for($a=0; $a<30; $a++)  {

//  I guess this part may have some problems...
  $getline = fgetss($handle, 1024);                                                     

//  this function, htmlspecialchars() is not solusion...
   $getline = htmlspecialchars($getline);                                               
   echo("<br>"); 

// so.I tried to use the function,strlen() 
// echo strlen($getline); in order to check the fgetss 
// function..
   echo($getline); 

echo ("<br>");                                                   
  }

  fputs($handle,"close\r\n");
  fclose($handle);

?>
--------------------------------------------------------------------


result
--------------------------------------------------------------------
...
Message-ID: 14                                            // fgetss function returns just 14...
References: 14                                             // fgetss function returns just 14...
...
--------------------------------------------------------------------

I think that the fgetss function is not suitable...
Is there auy other function like imap_header()?
I really need your help...
so, please help me....
Break a leg... 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-11 10:57 UTC] chagenbu at cvs dot php dot net
From the description of fgetss in the manual:

Identical to fgets(), except that fgetss attempts to strip any HTML and
PHP tags from the text it reads.

<me@foo.com>

Looks like an html tag, since it's between angle brackets. So use fgets instead.

And yes, the imap functions should be usable with nntp. If you check the list
archives, you should find an example of how to use them.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC