2

I am trying to create a personal job board using RSS feeds from Craigslist, Reddit, Kijiji, and Indeed.

I have found a method (using magpie) to bring in the multiple feeds, however I am not able to parse any data from Indeed.ca. I tried echoing the results at different stages, to make sure Iw as connected to the RSS Feed for Indeed, and I was able to get information, but it won't display on the finished product.

Here's my code to call the RSS Feeds (rss-urls.php):

$urls = array(
//Craigslist RSS Feeds
'http://toronto.en.craigslist.ca/med/index.rss', 
//Reddit RSS Feeds
'http://www.reddit.com/r/forhire/new/.rss',
//Kijiji RSS Feeds
'http://www.kijiji.ca/rss-srp-graphic-web-design-jobs/owen-sound/c152l1700187',
//Indeed RSS Feed
'http://www.indeed.ca/rss?q=Graphic+Designer&l=Toronto%2C+Ontario');

foreach($urls as $url) {
    $rss = fetch_rss($url);


    foreach ($rss->items as $item ) {
        $title = $item[title];
        $url   = $item[link];
        $description   = $item[description];
        $date = $item['dc']['date'];

//print_r($tot_array);
rsort($tot_array);

And here's the code that takes the feed's info and displays it:

foreach($tot_array as $tot) {
$all = explode(",",$tot);
$date = date("Y-m-d",strtotime($all[4]));
$now = date("Y-m-d");
$title = $all[1];
$url = $all[2];
$description = $all[3];
//echo $tot."";
//print $url;
if (false !== strpos($url,'indeed')) {
    echo '<div id="linkCell" style="width: 100%;">';
    echo '<div id="vAlign">';
    echo '<p class="linkTitle"><a href="'.$url.'" title="'.$title.'">'.$title.'</a></p><br />';
    //echo '<span class="date">Post is '. date_diff(date_create($date), date_create($now))->format('%a day(s) old') .'</span></p>';
    echo '<p class="description">'.$description.'</p>';
    echo '</div>';
    echo '</div>';
       echo '<span style="color:white;">'.$date."</span><br>";
} 

}

BrianisBS
  • 41
  • 1
  • 5

1 Answers1

0

If you run the result on a browser, you can see there are lots of empty lines from Indeed RSS feed. I would trim out those lines before parsing it.

Annie C
  • 764
  • 2
  • 12
  • 31