note 20774 deleted from function.curl-setopt by danbrown

From: Date: Sun, 17 May 2009 17:36:47 +0000
Subject: note 20774 deleted from function.curl-setopt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155006@lists.php.net to get a copy of this message
Note Submitter: jckim at iquick4u dot com ---- #!/usr/local/bin/php -q <?php $id = "xxxx"; $pw = "xxxx"; $LOGINURL = "http://login.daum.net/Mail-bin/login.cgi"; $GETURL = "http://www.daum.net/Mail-bin/mail_list"; $POSTFIELDS = "id=$id&pw=$pw"; function AUTH_SITE_COOKIE_STORE($LOGINURL,$POSTFIELDS) { $parseURL = parse_url($LOGINURL); $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "$parseURL[host].cookie"); curl_setopt($ch, CURLOPT_URL,"$LOGINURL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "$POSTFIELDS"); ob_start(); curl_exec ($ch); ob_end_clean(); curl_close ($ch); return "$parseURL[host].cookie"; } function AUTH_SITE_GET($GETURL,$cookieFile) { $parseURL = parse_url($GETURL); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, "$cookieFile"); curl_setopt($ch, CURLOPT_URL,"$GETURL"); $result = curl_exec ($ch); curl_close ($ch); $fp = fopen ("$parseURL[host].html", "w"); fwrite($fp,$result); fclose ($fp); return $result; } $cookieFile = AUTH_SITE_COOKIE_STORE($LOGINURL,$POSTFIELDS); echo $result = AUTH_SITE_GET($GETURL,$cookieFile); ?>

« previous php.notes (#155006) next »