How to do this foreach to get news?

Asked

Viewed 33 times

0

I have a link that I believe is an API, and I need to pick up the news (as if it were a feed) but I’ve done several foreach I can’t associate to bring the text I want inside PHP, follows the link from the api: https://www.caseih.com/latam/pt-br/_layouts/15/Caseih/Servicemanager.aspx? d=tl-news-release&sort=desc&count=20, someone can help me?

PHP:

$json_file = file_get_contents("https://www.caseih.com/latam/pt-br/_layouts/15/CaseIH/ServiceManager.aspx?d=tl-news-release&sort=desc&count=20");
$json_output = json_decode($json_file, true);
echo '<pre>';
var_dump( $json_output );

foreach ($json_output as $resultado){
    foreach ($resultado as $items){
        var_dump($items);
    }
}

Then when I try to add ->title or ->date it returns me error, I don’t know if it’s because I didn’t associate wrong or something like..

  • Put your last attempt on the question and describe what happened, please, to get a sense of what you’ve done and not have to start from scratch.

  • I added the code..

  • You could help me @Andersoncarloswoss ?

  • The idea arose from this theme but is not equal, did not apply my question..

  • It’s the same, yes. Just fit the read JSON. You know the JSON format?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.