Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End help with news feeds

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #197057
    ninjacd
    Participant

    Hi guys,

    Can anyone help with this? I have a client that needs a site with news feeds like AP(Associated Press) but He only wants news feeds that deal with crime and only in Michigan I plan on doing this site in Word Press if that helps.

    #197061
    Paulie_D
    Member

    What have you tried?…That’s kind of a broad request.

    #197064
    ninjacd
    Participant

    I’m trying to find news feeds on crime in Michigan but i can’t find any rss feeds on just that so I’m looking for ideas

    #197065
    Alen
    Participant
    #197066
    ninjacd
    Participant

    what I’m wondering is if anybody knows of any plug-ins or code I could use to filter out all the stories that are not about crime or being arrested?

    #197067
    Alen
    Participant

    As far as plug-ins go I’m not sure if there are any for what you’re trying to achieve. I haven’t looked or done the research

    Anyhow, if you need help parsing the RSS, you can do something like:

    # This would come from the form request
    # http://localhost.dev/?request=Michigan%20Crime
    # $request = $_GET["request"];
    $request = 'Michigan%20Crime';
    
    $rss_feed= implode(file('https://news.google.com/news?q='.$request.'&output=rss'));
    $xml = simplexml_load_string($rss_feed);
    $json = json_encode($xml);
    $rss= json_decode($json,TRUE);
    
    foreach($rss["channel"]["item"] as $item) {
        // var_dump($item);
        echo '<h3><a href="'.$item["link"].'">'.$item["title"].'</a></h3>';
    }
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.