Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>New Craigslist listings</title>
- <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
- <link href='http://fonts.googleapis.com/css?family=Milonga' rel='stylesheet' type='text/css'>
- </head>
- <body>
- <p>
- <?php
- $cities = array("washingtondc", "miami", "sfbay", "newyork", "losangeles", "sandiego"); #Craigslist subdomains
- $keywords = array("web*", "wordpress", "site"); # What you want to search for...
- $category = "cpg"; # Craigslist category key
- foreach ($cities as $city) {
- $link = "http://" . $city . ".craigslist.org" . "/" . $category;
- $dom = new DomDocument($link);
- @$dom->loadHTML($html);
- $urls = $dom->getElementsByTagName('a');
- foreach ($urls as $url) {
- $attributes = $url->attributes;
- echo "<br>$url->nodeValue is $attributes->href";
- ob_flush();
- flush();
- break;
- }
- }
- ob_end_flush();
- ?>
- </p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement