Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Jak dodać wynik funkcji do zmiennej?
Siper
post 20.10.2010, 22:02:24
Post #1





Grupa: Zarejestrowani
Postów: 60
Pomógł: 1
Dołączył: 25.04.2009

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


Mam taką funkcję:

  1. function connect_curl($url, $post='')
  2. {
  3. $curl=curl_init();
  4. curl_setopt($curl, CURLOPT_URL, $url);
  5. curl_setopt($curl, CURLOPT_REFERER, "http://www.google.pl");
  6. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  7. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10');
  8. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  9. curl_setopt($curl, CURLOPT_HEADER, 0);
  10. if(strlen($post)>0)
  11. {
  12. curl_setopt($curl, CURLOPT_POST, 1);
  13. curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
  14. }
  15. $strona=curl_exec($curl);
  16. curl_close($curl);
  17. }


Po dodaniu jej do strony od razu się wyświetla wynik, a ja bym chciał jeszczę pobraną stronę przerobić, czyli po prostu dodać ją do zmiennej. Jak coś takiego zrobić? próbowałem "$zmienna = connect_curl(cos, tam);", ale nic nie dało.

Ten post edytował Siper 21.10.2010, 13:46:53
Go to the top of the page
+Quote Post
flashdev
post 20.10.2010, 22:38:00
Post #2





Grupa: Zarejestrowani
Postów: 812
Pomógł: 117
Dołączył: 2.12.2008

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


  1. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);


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

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 Wersja Lo-Fi Aktualny czas: 18.07.2025 - 02:41