Posts

Showing posts from 2019

Craigslist Search Code in PHP

Below are code for craigslist search and Source to download the file <?php require 'simplehtmldom/simple_html_dom.php'; $url = 'https://miami.craigslist.org/search/sss?query=chair'; $html = file_get_html($url); $results = array(); foreach ($html->find('li[class=result-row]') as $row) {     $pid = $row->getAttribute('data-pid');     $tmp = $row->find('a[class=result-image]', 0);     $url = $tmp->getAttribute('href');           $price = "$0";     $tmp = $row->find('span[class=result-price]', 0);     if ($tmp) {         $price = $tmp->plaintext;     }     $date = $row->find('time[class=result-date]', 0)->plaintext;     $title = html_entity_decode($row->find('a[class=result-title]', 0)->plaintext);     $location = '(' . $area . ')';     if ($row->find('span[class=result-hood]'...