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?

Did you know?Explore Trending and Topic pages for more stories like this.
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 Like 49 Dislike
Previous forums Next forums
Other forums

Session login issue
I'm wondering how to fix a problem I'm having with a session-based login system

Say I go to h

http to https
Hi,

Is there any specific method/condition to move an http:// page to https:// ?

Retrieving Data from Two Different Databases
Hello All,

Ran into another problem and would appreciate some help! I have two datab

URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But

Displaying Site Logo/Icon on a Title tag
really need some help out here. I want to insert a Logo/Icon just like the one close to the "PH

Batch Session SM35 stuck in status 'in Background
Hi Experts,

I am facing a problem with Batch Input session SM35.

The batch se

Form a inline view based on the results of the previous query?
Hi Experts,
Can we form a inline view on the results of a previous query (another inline view)?

Update not working ... please help
Hi,

I am trying to update a row using an edit form by passing id of the row .. but it is not

script and html conflict in trying to create a header.
I have an error is occurring because of an html webpage with a "php require" at the top of

storing video files into mysql in php
hi

i have my video files in my folder ,
i have to store the path of the videos into db an

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash