Searching for classifieds
For the classifieds search, we're going back to Yahoo's YQL service and we'll be searching using Craigslist. Once set up, you'll be able to type "classifieds ipad" into your phone and it will return any local iPads that are for sale.
Getting ready...
The complete source code for this recipe can be found in the Chapter5/
folder.
How to do it...
This recipe is mostly for my wife but it's always handy to have a way to search local classifieds sites for items you want to buy. Upload a file called classifieds.php
to your web server in the pages folder and add the following code to it:
<?php $results = classifieds( $_POST['FromCity'], $keywords ); $cnt = count( $results->item ); $i = 1; $reply = array(); foreach($results->item as $item){ $item->title = $item->title[0]; $item->title = str_replace(" & "," and ",$item->title); $msg = $item->title."\n".$item->link; $reply[] = $msg; $i++; if( $i == 10) break; } print_sms_reply...