topical media & game development

talk show tell print

mashup-delicious-11-autobookmarkers-hotjobs.php / php



  <?php
  //bring in magpie goodness
  require_once('lib/rss_fetch.inc');
  
  //set cache directory
  define('MAGPIE_CACHE_DIR', 'cache');
  
  //get rid of error Notices because magpie produces some
  error_reporting(E_ERROR | E_WARNING | E_PARSE);
  
  //delicious mashups libarary - set your username and password please!
  define('DELICIOUS_USERNAME','username');
  define('DELICIOUS_PASSWORD','password');
  
  //bring in delicious_mashups.inc.php
  require_once('lib/delicious_mashups.inc.php');
  
  //base hotjobs url
  define('HOTJOBS_URL','http://hotjobs.yahoo.com/rss/0/');
  
  //your slacker friend's username on del.icio.us
  define('SLACKER_FRIEND','friendsusername');
  
  //enter a - (dash) for unused elements
  country = 'USA';
  state = 'CO';
  city = '-';
  category = 'RFS';
  keywords = 'pizza';
  
  //assemble the complete url
  feed_url = HOTJOBS_URL.country."/".state."/".city."/".category."/".keywords;
  
  //grab the feed
  rss = fetch_rss(feed_url);
  
  echo "Checking for items at ".feed_url."\n";
  
  //post the items found if they don't exist
  //tagging them with for:SLACKER_FRIEND
  foreach (rss->items as item)
  {
      //check to see if the url has already been posted
      do_api_call('/posts/get?',"&url=".urlencode(item['link']));
      if (!isset(api_return[0]['children']))
      {
          url = item['link'];
          description = item['title'];
          extended = item['description'];
          tags = "for:".SLACKER_FRIEND." autobookmarked jobs";
          do_api_call('/posts/add?',"&url=".urlencode(url)."&description=".urlencode(description)."&extended=".urlencode(extended)."&tags=".urlencode(tags));
          if (api_return['status'] == 200)
              echo "Posted: ".description."\n";
          else
              echo "There was a problem posting ".description."\n";
      } else {
          echo item['link']." already posted - skipping\n";
      }
  }
  
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.