Witam chciałbym się wyedukowac w curl
jestem narazie zielony
czytam manuala i troche tego nie rozumiem
PRosze mi powiedzec od czego zaczać
np chce zeby curl zalogował sie na pewna strone i pobrał tresc po zalogowaniu
curl_setopt( $curl, CURLOPT_RETURNTRANSFER ,1); $strona= curl_exec( $curl ); curl_close( $curl );
<?php /* -------------------- LOGOWANIE -------------------- */ $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; $przegladarka='Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.12) Gecko/2008020121 Firefox/2.0.0.12'; $naglowki=array('Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Language: pl,en-us;q=0.7,en;q=0.3','Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7'); //-------------- $link = 'link'; $link2 = 'link2'; $pola = $_POST['pola'] = 'username=xxx&password=xxx&submit=Zaloguj'; //------------------- $cookie_file = 'cookie.txt'; //-------------- $h = curl_init(); //------------------- //-------------- curl_setopt($h, CURLOPT_URL, $link); curl_setopt($h, CURLOPT_POST, 1); curl_setopt($h, CURLOPT_POSTFIELDS, $pola); curl_setopt($h, CURLOPT_COOKIEFILE, "$DOCUMENT_ROOT/$cookie_file"); curl_setopt($h, CURLOPT_COOKIEJAR, "$DOCUMENT_ROOT/$cookie_file"); curl_setopt($h, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($h, CURLOPT_USERAGENT, $przegladarka); curl_setopt($h, CURLOPT_ENCODING, ''); curl_setopt($h, CURLOPT_HTTPHEADER, $naglowki); //------------------- $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_URL, $link2); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_USERAGENT, $przegladarka); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_exec($ch); curl_close($ch); curl_close($h); ?>