I'm trying to get the content of a webpage that require authentication using PHP.
Ideally, I'd like to use the simple html dom parser: http://simplehtmldom.sourceforge.net.
Anyone knows of a way to do this?
Edit:
Tried the following code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username=' . urlencode($username) . '&password=' . urlencode($pass));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
echo curl_exec($ch);
curl_close($ch);
But now I get a 405 HTTP error.