Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][HTML] Zamiana IFRAME cna CURL
arkos
post
Post #1





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 24.12.2009

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


Mam problem z jednym jak zastąpić iframe funkcją curl. Męczę już się z tym długo i nie umię sobie poradzić (IMG:style_emoticons/default/sad.gif) ?
Mam taki link:
  1. echo '<iframe src=http://'.$row['ip'].':'.$row['port'].'/admin.cgi?mode=updinfo&pass='.$row['haslo'].'&song='.$tekst.'></iframe><br />';

Pozdrawiam,
Go to the top of the page
+Quote Post
neverever
post
Post #2





Grupa: Zarejestrowani
Postów: 278
Pomógł: 44
Dołączył: 17.02.2004
Skąd: Wieliczka

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


Najprościej
  1.  
  2. function geturl($url){
  3. $curl = curl_init();
  4. curl_setopt($curl, CURLOPT_URL, $url);
  5. curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)');
  6. curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
  7. curl_setopt($curl, CURLOPT_AUTOREFERER, true);
  8. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  9. curl_setopt($curl, CURLOPT_TIMEOUT, 10);
  10. $html = curl_exec($curl);
  11. curl_close($curl);
  12. return $html;
  13. }
  14.  
  15. $url='http://'.$row['ip'].':'.$row['port'].'/admin.cgi?mode=updinfo&pass='.$row['haslo'].'&song='.$tekst;
  16.  
  17. echo geturl($url);


Tylko czy musi vyc koniecznie curl? nie wystarczy file_get_contents() ?
Go to the top of the page
+Quote Post
arkos
post
Post #3





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 24.12.2009

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


Nie wiem czy to cron odczyta.

@edit
No, a skrypt nie działa, zmieniłem ten link dla testu na:
Cytat


No i pojawia mi się takie coś:
Cytat
ICY 404 Resource Not Found icy-notice1:
SHOUTcast Distributed Network Audio Server/Linux v1.9.8
icy-notice2:The resource requested was not found

No i oczywiście się nie wkonuje to co w linku (IMG:style_emoticons/default/sad.gif)

I co nikt nie pomorze mi?

Ten post edytował arkos 15.01.2010, 18:54:44
Go to the top of the page
+Quote Post
Misiur66
post
Post #4





Grupa: Zarejestrowani
Postów: 170
Pomógł: 11
Dołączył: 2.03.2008
Skąd: Lublin

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


Cytat
&song=ala ma kota


Nie gadaj że dałeś spacje!

Chyba że to forum przerobiło %20 na spacje.
Go to the top of the page
+Quote Post
arkos
post
Post #5





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 24.12.2009

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


Wiele to nie zmienia jak dam jakiś wyraz bez spacji nawet...
Go to the top of the page
+Quote Post
neverever
post
Post #6





Grupa: Zarejestrowani
Postów: 278
Pomógł: 44
Dołączył: 17.02.2004
Skąd: Wieliczka

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


daj adres http://google.pl i zobacz czy coś wypluje, jak tak, to curl działa.

-zmienne składające się na adres może będzie trzeba zakodować funkcją urlencode()
Go to the top of the page
+Quote Post
arkos
post
Post #7





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 24.12.2009

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


Tak, działa
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 - 21:31