title: How to extract data from an online API?
body: <p>It's a novice question so be kind to me :)</p>
  
  <p>How can I consume a php API in ASP.NET? This API returns an XML document. It is also capable of returning JSON.</p>
  
  <p>The output is shown below</p>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;Address&gt;
  
          &lt;Country&gt;US&lt;/Country&gt;
  
          &lt;City&gt;Seattle&lt;/City&gt;
  
          &lt;Result&gt;Done&lt;/Result&gt;
  
  &lt;/Address&gt;
  </code></pre>
  
  <p>JSON</p>
  
  <pre><code>{
  
  "CountryCode" : "US",
  
  "City" : "Seattle",
  
  "Result" : "Done"
  
  }
  </code></pre>
  
  <p>For eg: there is a service <a href="http://someservice.com/name_query.php?pincode=" rel="nofollow noreferrer">http://someservice.com/name_query.php?pincode=</a>  which accepts pincode and returns an XML document. </p>
  
  <p>Can I use LINQtoXML and consume it. Please an example of consuming with XML and one with JSON will be very helpful. </p>