Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] jak zastąpić CURLOPT_FOLLOWLOCATION inną funkcją?, problem z open_basedir i safe_mode
harpik
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 1
Dołączył: 21.10.2009

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


Witam, mam fragment kodu i pewną funkcję:
  1. function postdata($url, $string="", $reffer="http://www.blabla.com/bla"){
  2. $cookiefile = "ck/fl.txt";
  3. $agent="Mozilla/14.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  4. $ch = curl_init();
  5. curl_setopt($ch, CURLOPT_URL,$url);
  6. curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  7. curl_setopt($ch, CURLOPT_POST, 1);
  8. curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
  9. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  10. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  11. curl_setopt($ch, CURLOPT_REFERER, $reffer);
  12. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
  13. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
  14. $result = curl_exec ($ch);
  15. curl_close ($ch);
  16. return $result;
  17. }

Oraz problem - linię z CURLOPT_FOLLOWLOCATION, ze względu na ograniczenia hostingu (open_basedir) nie działa.
Niestety bez niej kod również nie działa tak jak powinien. Znalazłem rozwiązanie, inną funkcję dostępną tu:
http://pl.php.net/manual/pl/function.curl-setopt.php#79787 lecz nie wiem jak mam te dwie części ze sobą połączyć.
Proszę o pomoc.
Go to the top of the page
+Quote Post
vokiel
post
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Może tak:
  1. $result = curl_redir_exec($ch)
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 22.08.2025 - 13:14