I got redirected - but not with the username info on that page.
Code: Select all
<pre>
<?php
$u = "username";
$p = "password";
echo httpPOST_Curl("http://forums.devnetwork.net", "login.php", "username=$u&password=$p&autologin=on&login=Log%20in");
?>
<?
function httpPOST_Curl($Host, $Path, $Data)
{
$handle = curl_init();
curl_setopt ($handle, CURLOPT_URL, $Host."/".$Path);
curl_setopt ($handle, CURLOPT_POST, TRUE);
curl_setopt ($handle, CURLOPT_POSTFIELDS, $Data);
curl_setopt ($handle, CURLOPT_HEADER, TRUE);
curl_setopt ($handle, CURLOPT_USERAGENT, "Mozilla/5.0");
curl_setopt ($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($handle, CURLOPT_REFERER, "localhost");
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
$file_contents = curl_exec($handle);
curl_close($handle);
return $file_contents;
}
?>