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
Help with explandable category tree
I have the below query:
SELECT l1.id as lev1_id,l2.id as lev2_id,l3.id as lev3_id,l1.categ
This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the
Need help Updating SQL Server Express DB from c# :(
Please can anyone help with:-
1 How to sructure the strSelect statement.
2 How to instruct
DELETE FROM not working deletes wrong row
Hello
I have the following code which i found but it doesnt work properly.. it comes up with
imap: how to save a copy of sent emails to sent elements
Hello my friends,
I am writing an online emailing application with inbox outbox/sent elements
generating all possible random letters
hi'
how can i randomize the letters a,b,c,d,e all possible ways, and i want to print the res
Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The
Create a form of 2 numbers input and find the greatest.
Hi, everybody.
I have a homework in my training of php, which ask you to make a form that ask
What are the two different files you download to update kernel?
What are the two different files you download to update kernel?
HTML form problem
Ive made a form to that i want to send to my email via PHP. but when it send only the name's etc sen