Hi Guys
I can login into the site, a session is created and stored in cookies.txt but i dont know how to begin the next step where the script needs to submit another form in the members area on the same website. basically the plan is, i create my own form and send data to curl script which will login into external website form, create session, then send data created from my own form to to external website members form page. This way i will be able to store the data on my database and sent to them. But now i am lost. Please help me, thanks in advance
function getData($data)
{
$query = "";
foreach ($data as $value => $name)
{
$query.=$value."=".$name."&";
}
return $query;
}
$var = substr(getData($_POST),0,-1);
$headers = array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0. Gecko/20061025 Firefox/1.5.0.8");
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://site.com/page.php');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=radio86&pass=phpfreaks');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/cookies.txt");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec ($ch);