View previous topic :: View next topic |
Author |
Message |
Mikor -
Joined: 21 Aug 2006 Posts: 144 Location: Hull, England
|
Posted: Tue Oct 31, 2006 12:00 am Post subject: fputs() causes Error 500 |
|
|
Here is my script, it was working fine (ie: connecting) before I put the fputs() in:
Code: | <?php
$mail['Server'] = 'mail.yarrt.com';
$mail['Username'] = 'mike@yarrt.com';
$mail['Password'] = '------';
$fp = fsockopen($mail['Server'],110);
$response = fgets($fp);
echo $response;
if(!strstr($response,'+OK')){exit;}
$put = 'USER '.$mail['Username'].'\r\n';
fputs($fp,$put);
echo $put.'<br/>';
$response = fgets($fp);
echo $response.'<br/><br/>';
if(!strstr($response,'+OK')){exit;}
$put = 'PASS '.$mail['Password'].'\r\n';
fputs($fp,$put);
echo str_replace($mail['Password'],str_repeat('*',strlen($mail['Password'])),$put).'<br/>';
$response = fgets($fp);
echo $response.'<br/><br/>';
if(!strstr($response,'+OK')){exit;}
$put = 'LIST\r\n';
fputs($fp,$put);
echo $put.'<br/>';
$response = fgets($fp);
echo $response.'<br/><br/>';
if(!strstr($response,'+OK')){exit;}
if(isset($_GET['message'])){
$put = 'RETR'.$_GET['message'].'\r\n';
echo $put.'<br/>';
$response = fgets($fp);
echo $response.'<br/><br/>';
}
fclose($fp);
?>
<form action = 'pop3.php' method='get'>
Message ID: <input type='text' name='message'/>
<br/><input type='submit' value='Get Message'/> |
And CGI.log says:
Code: | CGI: [E:\Servers\Abyss\PHP5\php-cgi.exe ] URI: /Utilities/pop3.php Broken pipe |
_________________ Yarrt.com - Free Arcade
RypNet.co.uk - Online Game
MSN: michael_walker_2004 <at> hotmail <dot> com |
|
Back to top |
|
|
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Tue Oct 31, 2006 12:37 am Post subject: Re: fputs() causes Error 500 |
|
|
Mikor wrote: | Here is my script, it was working fine (ie: connecting) before I put the fputs() in: |
Have you tried using fwrite() instead
They are both the same function, with fputs() being an alias of fwrite()
Also have you tried commenting out each fputs() to see which one might be causing the problem
Edit: Why are you connecting to the server, getting the response, and then writing something to the connection?
Is it a "feature" of mail servers, because if it was http you would open a connection, write something to the connection, and then get the response. _________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
|
Mikor -
Joined: 21 Aug 2006 Posts: 144 Location: Hull, England
|
Posted: Tue Oct 31, 2006 12:41 am Post subject: |
|
|
after a lot of commenting, i've found that its the fgets() that causes the error.
[edit]
Its also incredibly slow, i would make this program in VB6, but I dont know how to do it;
I know how to get all the messages, etc from the server, I just dont know how to output it for abyss
[edit2]
OK, i've figured out how to do it in VB6, so this topic is pretty much obsolete, however it would still be nice to have a fix for this error. _________________ Yarrt.com - Free Arcade
RypNet.co.uk - Online Game
MSN: michael_walker_2004 <at> hotmail <dot> com |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|