views:

450

answers:

2

Hi guys I wish to get information for entries I have in my database from wikipedia like for example some stadiums and country information. I'm using Zend Framework and also how would I be able to handle queries that return multiple ambiguous entries or the like.. I would like all the help I can get here...

+2  A: 

Do a simple HTTP request to the article you are looking to import. Here's a good library which might help with parsing the HTML, though there are dozens of solutions for that as well, including using the standard DOM model which is provided by php.

<?php
require_once "HTTP/Request.php";

$req =& new HTTP_Request("http://www.yahoo.com/");
if (!PEAR::isError($req->sendRequest())) {
    echo $req->getResponseBody();
}
?>

Note, you will be locked out of the site if your traffic levels are deemed too high. (If you want a HUGE number of articles, download the database)

altCognito
Whoa I didn't know that you could do that - I've downloaded the database and started a new thread on the meticulous task of importing it - thanks for the tip man :)
Ali
+7  A: 

Wikipedia based on MediaWiki, that have API.

You can try MediaWiki API on Wikipedia - http://en.wikipedia.org/w/api.php

Documentation for MediaWiki API - http://www.mediawiki.org/wiki/API

MicTech
Thats cool but are there any tutorials or starter code to get started. Basically I don't have the exact name of the article just an entry in my database and I was wondering if I could get a corresponding article from the wikipedia.
Ali