Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z curl
bagsiur
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 28.11.2008
Skąd: Będzin

Ostrzeżenie: (10%)
X----


  1. <?php
  2. $link='http://translate.google.pl/translate_a/t?client=t&text=kwiat&sl=pl&tl=bg&prev=enter%20HTTP/1.1';
  3. $curl = curl_init();
  4. curl_setopt($curl, CURLOPT_URL, $link);
  5. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  6. curl_setopt($curl, CURLOPT_TIMEOUT, 15);
  7. $wynik = curl_exec($curl);
  8. curl_close($curl);
  9. echo $wynik;
  10. ?>


Czemu nie wyświetla mi właściwego tekstu. Zwłaszcza że sam skrypt jest dobry?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
chce łyknąć dokładnie to co jest tutaj: [link]http://translate.google.pl/translate_a/t?client=t&text=kwiat&sl=pl&tl=bg&prev=enter%20HTTP/1.1[/link] w dalszej części swojego skryptu sobie poradzę... mam zamiar przetłumaczyć pare słów, losowych... help me juz taki zaspany jestem... (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
erix
post
Post #2





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Czekam na PW z sensownym tytułem wątku.

edit: otwieram
Go to the top of the page
+Quote Post
bagsiur
post
Post #3





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 28.11.2008
Skąd: Będzin

Ostrzeżenie: (10%)
X----


juz działa...

  1. <?php
  2. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; bg; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
  3. $headers = array('Accept-Language: ru,en-us;q=0.7,en;q=0.3',
  4.                'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7');
  5. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  6. ?>
Go to the top of the page
+Quote Post
matx132
post
Post #4





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


problem załatwiony na gg:)
wsytarczy dodac USERAGENT
  1. <html>
  2. <head>
  3.    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  4. </head>
  5.  
  6. <?php
  7. $link='http://translate.google.pl/translate_a/t?client=t&text=kwiat&sl=pl&tl=bg';
  8. $curl = curl_init();
  9. curl_setopt($curl, CURLOPT_URL, $link);
  10. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($curl, CURLOPT_TIMEOUT, 15);
  12. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
  13. $headers = array('Accept-Language: ru,en-us;q=0.7,en;q=0.3',
  14.                 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7');
  15. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  16.  
  17. $wynik = curl_exec($curl);
  18. curl_close($curl);
  19. echo $wynik;
  20. ?>
Go to the top of the page
+Quote Post
bagsiur
post
Post #5





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 28.11.2008
Skąd: Będzin

Ostrzeżenie: (10%)
X----


dębiec nabijasz posty (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
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: 24.08.2025 - 21:48