Hi guys, I noticed there was a question somewhat similar to mine, only with c#:link text. Let me explain: I'm very new to the whole web-services implementation and so i'm experiencing some difficulty understanding (especially due to the vague mediawiki api manual).
I want to retrieve the entire page as a string in PHP (xml file) and then process it in PHP (i'm pretty sure there are other more sophisticated ways to parse xml files but w/e): Main Page wikipedia.
I tried doing $fp = fopen($url,'r');
it outputs: HTTP request failed! HTTP/1.0 400 Bad Request
. the api does not require a key to connect to it.
Can you describe in detail how to connect to the API and get the page as a string?
Thank you.
EDIT:
the url is this: $url='http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=xml&redirects&titles=Main Page';
I simply want to read the entire content of the file into a string to use it.