i’m trying to check my email with curl.
I’ve got a function which connects to gmail:
function check_email($url)
{
// sendRequest
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0);
$curlData = curl_exec($curl);
curl_close($curl);
//returning retrieved message
return $curlData;
}
When I call the function and echo it ($email = check_email($ur);), gmail sends me some html instead of showing the message:
echo $email;
<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="-very large url-">here</A>.
</BODY>
</HTML>
so i want to then extract the "-very large url-" and curl to that, but when i var_dump($email) it says it’s a bool! why is it returning html if it’s a boolean and how can i get to the aforementioned html via php?
http://php.net/manual/en/function.curl-exec.php says
Looks like you’ve got
CURLOPT_RETURNTRANSFERset to 0 (false).http://php.net/manual/en/function.curl-setopt.php