title: PHP connecting to MediaWiki API and retrieve data
body: <p>I noticed there was a question somewhat similar to mine, only with c#:<a href="https://stackoverflow.com/questions/773029/c-webrequest-to-connect-to-wikipedia-api">link text</a>.
  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).</p>
  
  <p>I want to retrieve the <em>entire page as a string</em> 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 whatever):
  <a href="http://en.wikipedia.org/w/api.php?action=query&amp;prop=revisions&amp;rvprop=content&amp;format=xml&amp;redirects&amp;titles=Main%20Page" rel="nofollow noreferrer">Main Page wikipedia</a>.</p>
  
  <p>I tried doing <code>$fp = fopen($url,'r');</code>. It outputs: <code>HTTP request failed! HTTP/1.0 400 Bad Request</code>. The API does not require a key to connect to it.</p>
  
  <p>Can you describe in detail how to connect to the API and get the page as a string?</p>
  
  <p><strong>EDIT:</strong>
  The URL is <code>$url='http://en.wikipedia.org/w/api.php?action=query&amp;prop=revisions&amp;rvprop=content&amp;format=xml&amp;redirects&amp;titles=Main Page';</code>. I simply want to read the entire content of the file into a string to use it.</p>