Wikipedia XML -> PHP?

This is a discussion on Wikipedia XML -> PHP? within the PHP Language forums, part of the PHP Programming Forums category; How would I get this Wikipedia XML: http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP variable (without copy ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-08-2006
Cain
 
Posts: n/a
Default Wikipedia XML -> PHP?

How would I get this Wikipedia XML:
http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
variable (without copy and pasting it manually)?

Thanks,

Cain.


Reply With Quote
  #2 (permalink)  
Old 09-08-2006
Benjamin Esham
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?

Cain wrote:

> How would I get this Wikipedia XML:
> http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
> variable (without copy and pasting it manually)?


Use file_get_contents():

http://us3.php.net/manual/en/functio...t-contents.php

By the way... if you're going to be doing a lot of work with Wikipedia's
data, please download your own copy of the database:

http://en.wikipedia.org/wiki/Wikiped...abase_download
http://download.wikimedia.org/

Not only will your scripts run faster, but it will also take some strain off
of Wikipedia's servers.

HTH,
--
Benjamin D. Esham
bdesham@gmail.com | AIM: bdesham128 | Jabber: same as e-mail
"In the beginning the Universe was created. This has made a lot
of people very angry and been widely regarded as a bad move."
— Douglas Adams
Reply With Quote
  #3 (permalink)  
Old 09-08-2006
Cain
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?


"Benjamin Esham" <bdesham@gmail.com> wrote in message
news:Ea2Mg.103$Ka1.58@news01.roc.ny...
> Cain wrote:
>
>> How would I get this Wikipedia XML:
>> http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
>> variable (without copy and pasting it manually)?

>
> Use file_get_contents():
>
> http://us3.php.net/manual/en/functio...t-contents.php
>
> By the way... if you're going to be doing a lot of work with Wikipedia's
> data, please download your own copy of the database:
>
> http://en.wikipedia.org/wiki/Wikiped...abase_download
> http://download.wikimedia.org/


I don't want to download the entire database, I only want some of the
articles. Can someone please tell me how I can get these articles into a
MySQL database?

Thanks,

Cain.


Reply With Quote
  #4 (permalink)  
Old 09-11-2006
Piet van Oostrum
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?

>>>>> "Cain" <Cain34345@243K4ooko342o.net> (C) wrote:

>C> How would I get this Wikipedia XML:
>C> http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
>C> variable (without copy and pasting it manually)?


You mean the contents of the document that the URL points to?

$url = "http://en.wikipedia.org/wiki/Special:Export/Alastair_Ralphs";
$handle = fopen($url, "r");
$contents = stream_get_contents($handle);
fclose($handle);

or use file_get_contents.
--
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org
Reply With Quote
  #5 (permalink)  
Old 09-11-2006
IchBin
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?

Piet van Oostrum wrote:
>>>>>> "Cain" <Cain34345@243K4ooko342o.net> (C) wrote:

>
>> C> How would I get this Wikipedia XML:
>> C> http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
>> C> variable (without copy and pasting it manually)?

>
> You mean the contents of the document that the URL points to?
>
> $url = "http://en.wikipedia.org/wiki/Special:Export/Alastair_Ralphs";
> $handle = fopen($url, "r");
> $contents = stream_get_contents($handle);
> fclose($handle);
>
> or use file_get_contents.

This is not a solution that you maybe looking for but here goes. The
Eclipse IDE has a wikipedia Plugin that will pert much let you download
change and upload.. There is much more to to this plugin. I figured I
would let you be aware of it.

Naturally the Eclipse link is:
http://www.eclipse.org/downloads

The plugin link is here:
http://www.plog4u.org/index.php/Main_Page

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Reply With Quote
  #6 (permalink)  
Old 09-11-2006
IchBin
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?

Piet van Oostrum wrote:
>>>>>> "Cain" <Cain34345@243K4ooko342o.net> (C) wrote:

>
>> C> How would I get this Wikipedia XML:
>> C> http://en.wikipedia.org/wiki/Special...lastair_Ralphs into a PHP
>> C> variable (without copy and pasting it manually)?

>
> You mean the contents of the document that the URL points to?
>
> $url = "http://en.wikipedia.org/wiki/Special:Export/Alastair_Ralphs";
> $handle = fopen($url, "r");
> $contents = stream_get_contents($handle);
> fclose($handle);
>
> or use file_get_contents.


This is not a solution that you maybe looking for but here goes. The
Eclipse IDE has a wikipedia Plugin that will pert much let you download
change and upload.. There is much more to to this plugin. I figured I
would let you be aware of it.

Naturally the Eclipse link is:
http://www.eclipse.org/downloads

The plugin link is here (Plog4U):
http://www.plog4u.org/index.php/Main_Page

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Reply With Quote
  #7 (permalink)  
Old 09-12-2006
Cain
 
Posts: n/a
Default Re: Wikipedia XML -> PHP?


> The
> Eclipse IDE has a wikipedia Plugin that will pert much let you download
> change and upload..


Thanks for this although I've not got it working yet.

I'm following these steps from
http://www.plog4u.org/index.php/Usin...ipedia_Article

"Example: grabbing a wikibooks.org article
a.. create a new index.wp file under your projects /wpsrc directory
b.. write a Wiki link definition somewhere in the editor, for example:
[[Programming:HTML]]
c.. do a "right mouse" click on the link and select menu Open Wiki Link
d.. a new file with the corresponding *.wp filename should open.
e.. do a "right mouse" click on the file name in the Navigator View' and
select menu Wikipedia Download->Refresh Wikipedia from Web
f.. in the opening dialog box select WikibooksEN Download"

However I when I do the last step I don't get any URLs in the opening dialog
box.

Can you help?

Thanks,

Cain.


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:32 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0