pop3 and fsockopen
Posted on
16th Feb 2014 07:03 pm by
admin
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am having a problem with server responses though.
In the following code, I don't understand why on the marked line I get a response. Right after I get the server response after sending the password I am able to fgets() and receive the info as if i had just sent the 'stat' command. But I didn't send it at all. Is this just an automated response I should expect, or a setting with the server?
Also, I never seem to get a response from the server when sending the 'list' command. I'm assuming I don't get a response because the browser just waits until timeout at that part of the script.
I am new to sockets and decided to learn them using pop3 as a project. Any help is appreciated.
Code: <?php
$fp=fsockopen("pop.1and1.com", 110, $errno, $errstr, 30);
if($fp){
echo 'Connected!
';
$username="USER email@edited.comrn";
$password="PASS mypasswordrn";
$us=fwrite($fp, $username, strlen($username));
$ur=fgets($fp);
echo 'Username sent, server response: '.$ur.'
';
$ps=fwrite($fp, $password, strlen($password));
$pr=fgets($fp);
echo 'Password sent, server response: '.$pr.'
';
//Question refers to this line
$res=fgets($fp);
$parts=explode(" ", $res);
echo $parts[4].' messages on server
';
//I don't get a response from this part.
$get=fwrite($fp, 'list');
$msg=fgets($fp);
echo $msg;
}
else{
echo 'Failed Connecting!
';
}
?>
Logged
Quote from: blmg911 on October 10, 2008, 03:29:28 PM<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>
i found that ERMMMMM thats called PHP!!!
No comments posted yet
Your Answer:
Login to answer
279
49
Other forums
Strange PHP/mySQL error ... am I just tired?
Code: <?
## CONNECT TO DB FUNCTION!
function ConnectTo($db2con)
{
$hostNam
Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right directi
Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,
constructor ?
i have written this program and made 3 constructors in the class and i want to call them in the main
Implementing Single Sign-On using SAML 1.1, x.509, LDAP in C#.net
Hi,
I got a requirement from the client i.e implementing single sing on using SAML 1.1( LDAP &
Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't work
Which par
upload image name with extension using php
hi frds..
<input id="file1" type="file" name="file[]" &a
PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data
Send current URL in URL with a $_GET variable problem.
Hello community,
I have created a function that gets the current variable of a page, example:
Form always sends to error page...
Hello,
Any help will be greatly appreciated. I am having trouble getting multiple fields to be re