Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [curl] błąd na serwerze CURLOPT_FOLLOWLOCATION
Lejto
post
Post #1





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


Napisałem kod który loguje się na serwis. Na localhoście wszystko działa. Wrzuciłem pliki na serwer odpalam i otrzymuje taki błąd
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

Kod
  1. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  2. <base href="http://s.pl"/>
  3. <?
  4. include("db.class.php");
  5. $db = new DB();
  6.  
  7. $sql = $db->query("select pass,nick from config");
  8. $row = $sql->fetch_array();
  9.  
  10. $nick = $row[nick];
  11. $pass = $row[pass];
  12.  
  13. $cookie = 'cookie.txt';
  14.  
  15. $loginUrl = 'http://strona.pl/login';
  16. $login = $nick;
  17. $password = $pass;
  18. $useragent = 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3';
  19.  
  20. $ch = curl_init( $loginUrl );
  21. curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie );
  22. curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie );
  23. curl_setopt( $ch, CURLOPT_COOKIE, $cookie);
  24. curl_setopt( $ch, CURLOPT_USERAGENT, $useragent );
  25. curl_setopt( $ch, CURLOPT_POST, true );
  26. curl_setopt( $ch, CURLOPT_POSTFIELDS, 'login='.$login.'&password='.$password );
  27. curl_setopt( $ch, CURLOPT_REFERER, 'http://strona.pl/' );
  28. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  29. curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
  30. $afterLogin = curl_exec($ch);
  31. curl_close($ch);
  32.  
  33.  
  34. $ch = curl_init( 'http://strona.pl/');
  35. curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie);
  36. curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie);
  37. curl_setopt( $ch, CURLOPT_COOKIE, $cookie);
  38. curl_setopt( $ch, CURLOPT_USERAGENT, $useragent );
  39. curl_setopt( $ch, CURLOPT_HEADER, 0);
  40. curl_setopt( $ch, CURLOPT_REFERER, 'http://strona.pl/' );
  41. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  42. curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
  43. $profile = curl_exec($ch);
  44. curl_close($ch);
  45.  
  46.  
  47. //[...]
  48.  
  49. ?>

Będzie to działać poprawnie na serwerze u mnie? winksmiley.jpg

Pozdrawiam

Ten post edytował Lejto 9.09.2009, 15:53:12


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 08:06