$value) { $cookie .= "$key=$value; "; } curl_setopt($ch, CURLOPT_COOKIE, $cookie); } //print_r($cookiearr); //echo "
"; return $length; } $username = urlencode('duncan1201'); $password = "bdacd603"; $gacookie = "./tmp/".$username.'.txt'; if(file_exists($gacookie)){ unlink($gacookie); } $test ; $postdata="log=$username&pwd=$password&remember=on"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,"http://www.sg51.net/blogs/wp-login.php"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt ($ch, CURLOPT_COOKIE, $test); //curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie); //curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch, CURLOPT_HEADER, TRUE); curl_setopt ($ch, CURLOPT_REFERER, 'http://www.google.com'); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch, CURLOPT_POST, 1); //scurl_setopt ($ch, CURLOPT_HEADERFUNCTION, 'read_header'); $AskApache_result = curl_exec ($ch); curl_close($ch); echo $AskApache_result; //echo $test; //echo file_get_contents("c:/xampp/tmp/".$username.'.txt'); //unlink($gacookie); ?>