Cytat
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /s.php on line 29
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /s.php on line 42
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /s.php on line 42
Kod
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <base href="http://s.pl"/> <? include("db.class.php"); $db = new DB(); $sql = $db->query("select pass,nick from config"); $row = $sql->fetch_array(); $nick = $row[nick]; $pass = $row[pass]; $cookie = 'cookie.txt'; $loginUrl = 'http://strona.pl/login'; $login = $nick; $password = $pass; $useragent = 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3'; $ch = curl_init( $loginUrl ); curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie ); curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie ); curl_setopt( $ch, CURLOPT_COOKIE, $cookie); curl_setopt( $ch, CURLOPT_USERAGENT, $useragent ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, 'login='.$login.'&password='.$password ); curl_setopt( $ch, CURLOPT_REFERER, 'http://strona.pl/' ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); $afterLogin = curl_exec($ch); curl_close($ch); $ch = curl_init( 'http://strona.pl/'); curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt( $ch, CURLOPT_COOKIE, $cookie); curl_setopt( $ch, CURLOPT_USERAGENT, $useragent ); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_REFERER, 'http://strona.pl/' ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); $profile = curl_exec($ch); curl_close($ch); //[...] ?>
Będzie to działać poprawnie na serwerze u mnie?

Pozdrawiam