Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you have two options:</p> <p>The first option is to do this on the client side using Ajax: (<a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">http://api.jquery.com/jQuery.ajax/</a></p> <p>Code could look something like:</p> <pre><code>function CallOtherSite(otherSiteUrl) { $.ajax({ url: otherSiteUrl, cache: false, success: function (html) { //This will be the html from the other site //parse the html/xml and do what you need with it. } }); </code></pre> <p>Because this is done with JavaScript on the client side you will most likely run into a problem with CORS. (<a href="http://blogs.msdn.com/b/carlosfigueira/archive/2012/02/20/implementing-cors-support-in-asp-net-web-apis.aspx" rel="nofollow">http://blogs.msdn.com/b/carlosfigueira/archive/2012/02/20/implementing-cors-support-in-asp-net-web-apis.aspx</a>)</p> <p>The other option and better option in my opinion is to do this on the server side. (Either in a controller or view with Razor) (It will be much easier in the contoller...)</p> <pre><code>try { var request = (HttpWebRequest)WebRequest.Create(urlToOtherSite); request.Accept = "application/xml"; request.Method = "GET"; webResponse = (HttpWebResponse)request.GetResponse(); sr = new StreamReader(webResponse.GetResponseStream()); string responseText = sr.ReadToEnd(); } catch(Exception ex) { } finally { if (sr != null) { sr.Close(); } if (webResponse != null) { webResponse.Close(); } } </code></pre> <p>Then you can use the StreamReader to get the html/xml and do what you will with it.</p> <p>Hope this helps...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload