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 uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what c
Struct/union and scope problem!
HI all , I have
Code:
in header.h
typedef struct Node Link;
/* ---------
Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re
Multidimensional Array into an Html table, help!
Hello all, I am new to HTML/PHP so any help would be great.
I have a multidimensional array f
Need help making a blockquote and line items conditional
I have some code I bought a few years ago that allows my clients to update content on their site usi
Pass sql into pl/sql and create RMAN duplicate script.
Hi,
I'm new to pl/sql and I'm trying to write a script that will generate some RMAN comma
Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLAN
sapgui f4 help last search
I know this has to be simople. One user (maybe more) does not have the "last search saved" from the
Using mysql_real_escape_string for displayed content
On my website users can input data into a textarea and it will store it in the mysql database. But,
is_dir() problem
Hello,
I'm buidling a php scripts that dynamically get's subfolders from a specific folder.