If you want to access structured and readable news data from thousands of news publishers and blogs, try mediastack. This is an easy-to-use REST API interface delivering worldwide news, headlines, and blog articles in real-time. As always, it's FREE to use!

laravel feed latest news articles

Features

Feed the latest and most popular news articles into your website, fully automated:

Real-Time News Data

Historical News Data

News Headlines

7,500+ News Sources

50+ Countries

13 Languages

Access 7500 news sources worldwide, including some popular ones: CNN, ESPN, CBS, etc.

news popular ones

The API is very clear to use, check it out:

{
    "author": "Dan Peck",
    "title": "Hurricane Hanna makes landfall around 5 p.m. on Saturday.",
    "description": "Hurricane Hanna battered southern Texas with sustained winds of 75 mph and continued to deliver heavy rain and flash flooding as it moved inland late Saturday.",
    "url": "https://abcnews.go.com/US/hurricane-hanna-makes-landfall-texas/story?id=71985566",
    "source": "ABC News",
    "image": "https://s.abcnews.com/images/US/hanna-swimmer-mo_hpMain_20200725-163152_2_4x3t_384.jpg",
    "category": "general",
    "language": "en",
    "country": "us",
    "published_at": "2020-07-26T01:04:23+00:00"
},
{
    "author": "TMZ Staff",
    "title": "Nicki Minaj's Husband Gets Permission To Be There For Baby's Birth",
    "description": "Kenneth can be in the room when Nicki gives birth ... a judge just granted his request to tweak his pre-trial release conditions so he can travel with Nicki. With the court's order in place, KP can travel with Nicki periodically on biz…",
    "url": "https://www.tmz.com/2020/07/30/nicki-minaj-husband-asks-judge-be-there-child-birth/",
    "source": "TMZ.com",
    "image": "https://imagez.tmz.com/image/c1/4by3/2020/07/30/c115ad2dc849438a97a0ad3097b416df_md.jpg",
    "category": "general",
    "language": "en",
    "country": "us",
    "published_at": "2020-08-01T05:34:47+00:00"
}

Documentation

You can read the official documentation on the mediastack website.

How to use

Register to get a free API key

You need to go to mediastack and register to get a free API key.

Using Raw PHP/Laravel

You can use raw PHP/Laravel to grab the market data. Here is the sample code (which can be found at mediastack documentation):

$queryString = http_build_query([
  'access_key' => 'ACCESS_KEY',
  'keywords' => 'Wall street -wolf', // the word "wolf" will be
  'categories' => '-entertainment',
  'sort' => 'popularity',
]);

$ch = curl_init(sprintf('%s?%s', 'https://api.mediastack.com/v1/news', $queryString));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$json = curl_exec($ch);

curl_close($ch);

$apiResult = json_decode($json, true);

print_r($apiResult);

Using Python 3

# Python 3
import http.client, urllib.parse

conn = http.client.HTTPConnection('api.mediastack.com')

params = urllib.parse.urlencode({
    'access_key': 'ACCESS_KEY',
    'categories': '-general,-sports',
    'sort': 'published_desc',
    'limit': 10,
    })

conn.request('GET', '/v1/news?{}'.format(params))

res = conn.getresponse()
data = res.read()

Using jQuery or Javascript

$.ajax({
    url: 'https://api.mediastack.com/v1/news',
    data: {
      access_key: 'ACCESS_KEY',
      languages: 'fr,-en',
      countries: 'ca,fr',
      limit: 30,
      offset: 30,
    }
  }).done(function(data) {
    console.log(JSON.parse(data));
});

print(data.decode('utf-8'))