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
PHP error. Need help urgently
Hi,
I am programming a php site and have a problem that i just cant find out how to fix. When
mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???
this is the code i got
get font info from a font file
hello,
Does anyone know how to get font info from a font file ... using php of course !
<
Array to string conversion
Can anyone help me with this?
Notice: Array to string conversion in /home/..../index.php on l
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&Problems with returning true or false in eval()'d code Hi guys,
Would appreciate some help with a problem when running eval() on a function that sho list files from folder, only one for each date I have many files in a folder and wish to only list one of each date
these are the file names php require help needed Ok i tried to use the search funtion but the word require is everywhere.
i'm really new to cr php slowing my site? Hi all,
I think that one of the reasons that my site doesn't work fast is that the code is ve have trouble in a if condition The if below is working ok, it check when indexes, name, zipcode and state are empty. Code: &
|