Skip to content

Instantly share code, notes, and snippets.

@jmccartie
Created October 13, 2010 22:11
Show Gist options
  • Save jmccartie/625045 to your computer and use it in GitHub Desktop.
Save jmccartie/625045 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Moving to Oklahoma City</title>
<?
function listitems($url) {
$buffer = file_get_contents($url);
$xml = new SimpleXMLElement($buffer);
echo "<ul>";
foreach ($xml->item as $item){
$ns_dc = $item->children('http://purl.org/dc/elements/1.1/');
echo '<li><a href="' . $item->link. '">' . $item->title . '</a> (' . date('M jS' , strtotime($ns_dc->date)) . ')</li>';
}
echo "</ul>";
}
?>
</head>
<body>
(all entries searched for require pics, and have ranges from $650-800/mo)
<h1>2 Bedroom</h1>
<h2>Edmond</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=edmond&srchType=A&minAsk=650&maxAsk=800&bedrooms=2&hasPic=1&format=rss'); ?>
<h2>NorthWest</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=NW&srchType=A&minAsk=650&maxAsk=800&bedrooms=2&hasPic=1&format=rss'); ?>
<h2>Oklahoma City</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=oklahoma+city&srchType=A&minAsk=650&maxAsk=800&bedrooms=2&hasPic=1&format=rss'); ?>
<h1>3 Bedroom</h2>
<h2>Edmond</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=edmond&srchType=A&minAsk=650&maxAsk=800&bedrooms=3&hasPic=1&format=rss'); ?>
<h2>NorthWest</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=NW&srchType=A&minAsk=650&maxAsk=800&bedrooms=3&hasPic=1&format=rss'); ?>
<h2>Oklahoma City</h2>
<? listitems('http://oklahomacity.craigslist.org/search/apa?query=oklahoma+city&srchType=A&minAsk=650&maxAsk=800&bedrooms=3&hasPic=1&format=rss'); ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment