function fetch($url,$post=false,$cookie=false,$timeout=30) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
}
if ($post) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_POST, TRUE);
}
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
//curl_setopt($ch, CURLOPT_HEADER, TRUE); //debug
$output=curl_exec($ch);
curl_close($ch);
return $output;
}
$cookie=cookie.txt;
$url='http://www.imvu.com/catalog/login.php?action=process';
$post='avatarname=stormiie74&password=******';
fetch($url,$post,$cookie);
$credits_amount = $what_ordered->fields['products_quantity'];
$the_customer = $the_customer_name->fields['customers_telephone'];
$url='http://www.imvu.com/catalog/web_give_av.php?nav_section=credits&nav_subsection=give';
$post='action=confirm&confirm_password=*****&payee=' . $the_customer . '&payment_amount=' . $credits_amount*2000 . '&greeting=&Give=Give';
fetch($url,$post,$cookie);
$credits_amount = $what_ordered->fields['products_quantity'];
$the_customer = $the_customer_name->fields['customers_telephone'];
$url='http://www.imvu.com/catalog/web_give_av.php';
$post='action=process&confirm_password=*****&payee=' . $the_customer . '&payment_amount=' . $credits_amount*2000 . '&greeting=&Give=Give';
fetch($url,$post,$cookie);