Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Błąd Call to a member function
qoryto
post 19.01.2015, 19:02:58
Post #1





Grupa: Zarejestrowani
Postów: 63
Pomógł: 0
Dołączył: 1.07.2009
Skąd: Rzeszów

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


Witam. Posiadam skrypt kóry importuje video z youtube i mam taki problem:


Fatal error: Call to a member function find() on a non-object in /home/root/domains/localhost/public_html/import/index.php on line 178

Krótki kod:

  1. $ek = $_POST['kk']."?page=".$_POST['sayfa'];
  2. $al = get_data("http://www.youtube.com/".$ek);
  3. $dom = str_get_html($al);
  4.  
  5. $veriler = $dom->find('.videoBox'); // to jest linia 178
  6. $tonton = count($veriler) - 1;
  7.  
  8. $sondo = $_POST['adet'] + 5;
  9.  
  10. if($sondo <= count($veriler)-1)
  11. {
  12. $sondon = $sondo;
  13. }
  14. else
  15. {
  16. $sondon = count($veriler) - 1;
  17. }


na starszej wersji php działa wszystko elegancko, próbowałem modyfikowac kod bezskutecznie wg google.
Ktoś pomoże?
Go to the top of the page
+Quote Post
trueblue
post 19.01.2015, 19:24:43
Post #2





Grupa: Zarejestrowani
Postów: 6 803
Pomógł: 1827
Dołączył: 11.03.2014

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


Sprawdź czy źródło strony jest w zmienne $al.


--------------------
Go to the top of the page
+Quote Post
rad11
post 19.01.2015, 19:24:48
Post #3





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

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


Probujesz tutaj uzyc biblioteki html dom parser? A pozatym jak chcesz sie odwolac do obiektu bez stworzenia konstruktora? robisz $dom = str_get_html() i probujesz odwolac sie do obiektu $dom->find(). Jak juz to $dom = new str_get_html() i wtedy mozesz sie odwolac $dom->find()

Ten post edytował rad11 19.01.2015, 19:29:31
Go to the top of the page
+Quote Post
qoryto
post 19.01.2015, 19:29:14
Post #4





Grupa: Zarejestrowani
Postów: 63
Pomógł: 0
Dołączył: 1.07.2009
Skąd: Rzeszów

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


z tego co widze w tym skrypcie jest użyte simple_html_dom.php

a początek skryptu to:
  1. <?php require('simple_html_dom.php');
  2. if($_POST['sayfa']){



a dalej wyglada to tak:


  1. $ek = $_POST['kk']."?page=".$_POST['sayfa'];
  2. $al = get_data("http://www.youtube.com/".$ek);
  3. $dom = str_get_html($al);
  4.  
  5. $veriler = $dom->find('.videoBox');
  6. $tonton = count($veriler) - 1;
  7.  
  8. $sondo = $_POST['adet'] + 5;
  9.  
  10. if($sondo <= count($veriler)-1)
  11. {
  12. $sondon = $sondo;
  13. }
  14. else
  15. {
  16. $sondon = count($veriler) - 1;
  17. }
  18.  
  19. for($i=$_POST['adet']; $i<=$sondon; $i++)
  20. {
  21. $adres=$veriler[$i]->find('a', 0)->href;
  22. $tek=get_data("http://www.youtube.com".$adres);
  23. $dom2 = str_get_html($tek);
  24. //print_r(array($adres, $i, $veriler[$i]->outertext));exit;
  25. //preg_match('#\'image_url\'(.*?)\'(.*?)\'#si',$tek,$img);
  26. //preg_match_all('#<var>(.*?)</var>#si',$tek,$sur,PREG_SET_ORDER);
  27. //preg_match('#<H2>(.*?)</H2>#si',$tek,$aci);
  28.  
  29. $sama="http://www.youtube.com".$adres;
  30. $v_resim=$veriler[$i]->find('img', 0)->src;
  31. $v_title=$dom2->find('h1.grid_9', 0)->innertext;//$veriler[$i]->find('p.videoTitle', 0)->innertext;
  32. $sure=$veriler[$i]->find('span.duration', 0)->innertext;
  33.  
  34. /*
  35. $kadres=md5($adres);
  36. $kontrol=mysql_num_rows(mysql_query("SELECT * FROM ".$table_prefix."postmeta WHERE meta_key='kontrol' and meta_value='$kadres'"));
  37. if ($kontrol=='0')
  38. {*/
  39. ?>


Ten post edytował qoryto 19.01.2015, 19:30:57
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: 26.06.2025 - 23:39