<?php
/*
example usage
mediaStack ver 1.0
You must get an API key from https://mediastack.com/product
and enter it in the marketstack.class.php file
For complete documentation on each endpoint and available paramaters
see https://mediastack.com/documentation
*/
//instantiate the class
require('mediastack.class.php');
$media = new mediaStack();
//get 10 news stories on tennis from the USA
$media->setEndPoint('news');
$media->setParam('keywords','tennis');
$media->setParam('countries','us');
$media->setParam('limit','10');
$media->getResponse();
//display stories
foreach( $media->response->data as $story ){
echo '<div>'.$story->published_at.': '.$story->source.' reports '.$story->title.' [<a href="'.$story->url.'" target="_blank">Full Story</a>]</div>';
echo '<div><p>'.$story->description.'</p></div>';
echo '<hr>';
}
?>
|