note 20774 added to function.curl-setopt

From: Date: Tue, 16 Apr 2002 00:05:54 +0000
Subject: note 20774 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-29404@lists.php.net to get a copy of this message
#!/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); ?> -- http://www.php.net/manual/en/function.curl-setopt.php http://master.php.net/manage/user-notes.php?action=edit+20774 http://master.php.net/manage/user-notes.php?action=delete+20774 http://master.php.net/manage/user-notes.php?action=reject+20774

« previous php.notes (#29404) next »