1. <?php
  2. if ($_POST['link'])
  3. {
  4.  $link = $_POST['link'];
  5.  
  6.  $src = @file_get_contents($link);
  7.  
  8.  //&wrzuta_mini= &
  9.  
  10.  preg_match_all('#value="&lt;script type=&quot;text/javascript&quot;(.*?)&gt;&lt;/script&gt;"#si',$src,$matches);
  11.  
  12. $src = $matches['0']; // zrodlo input
  13.  
  14. preg_match_all('#&wrzuta_mini=(.*?)&#si',$src,$matches); // rozbijanie obrazka
  15.  
  16.  
  17. }
  18. ?>


Wywala błąd:
Warning: preg_match_all() expects parameter 2 to be string, array given in /home/microh/public_html/skifa/nie_zwiazane/allegro/wrzuta.php on line 18

Domyśliłem się, ze dlatego, że do drugiego preg_match_all jako 2 argument dajemy tablice a musi być string. Jak przekonwertowac??

// edit1.

Już sobie poradziłem.

Zrobiłem mini funkcje:

  1. <?php
  2. function array_to_string($array,$nr=0)
  3.  {
  4.  $i==0;
  5. foreach ($array as $index => $val)
  6.  {
  7.  if ($i==$nr)
  8.  {
  9.  $val2 .=$val;
  10.  }
  11.  $i++;
  12.  }
  13. return $val2;
  14. }
  15. ?>


a w lini: 12 dałem
  1. <?php
  2. $src = array_to_string($matches['0']);
  3. ?>


Pozdrawiam