user1382649
user1382649

Reputation: 25

Interacting with the Wikipedia API

Here's a link to get the intro for an article on Wikipedia about Goldman Sachs.

http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles=Goldman_Sachs&format=json&exintro=1

I have a two part question.

  1. How can I use PHP to run these kinds of API calls on the server side? I want to be able to hook up to the Wikipedia API for data on subjects, companies, people without using links
  2. How can I parse the JSON or XML so the output will be strictly text?

Any help would be greatly appreciated.

Upvotes: 2

Views: 260

Answers (1)

Quentin
Quentin

Reputation: 944301

How can I use PHP to run these kinds of API calls on the server side?

I believe cURL is the usual option. The manual has examples. You can also use fopen.

How can I parse the JSON

json_decode

Upvotes: 3

Related Questions