Hello,

I am experimenting with sockets and pop3.

I am trying to to connect to gmail with the following code. But it prints an empty string as a response. Should it not print out 200 OK? Could someone help me by pointing out what I am doing wrong. Many thanks in advance.

<?php
$sock = fsockopen('tcp://' . 'pop.gmail.com', '995');
fwrite($sock, 'USER ' . 'username' . "\r\n");
$response = trim(fgets($sock, 512));
echo $response;
?>

*bump*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.