SpeakeazyYT

Untitled

Sep 8th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. while($k>1) {
  2.     $html = file_get_contents($url."&page=".$k);
  3.     $document = phpQuery::newDocument($html);
  4.    
  5.     foreach ($document->find('.a-elem') as $item) {
  6.         $id = pq($item)->attr('data-id');
  7.         $getDetailPage = phpQuery::newDocument(file_get_contents("https://kolesa.kz/a/show/".$id));
  8.        
  9.         foreach ($getDetailPage->find('.offer__parameters dl') as $prop) {
  10.             $props[] = [
  11.                 'name' => trim(pq($prop)->find('dt')->attr('title')),
  12.                 'value' => trim(pq($prop)->find('dd')->html())
  13.             ];
  14.         }
  15.        
  16.         /*$data[] = [
  17.             'id' => $id,
  18.             'views' => getViewsItem($id),
  19.             'phone' => getPhones($id),
  20.             'props' => $props
  21.         ];*/
  22.        
  23.         $propsNew[] = $props;
  24.     }
  25.    
  26.     unset($html, $getDetailPage, $props);
  27.     $k--;
  28. }
  29.  
  30. print_r($propsNew);
Advertisement
Add Comment
Please, Sign In to add comment