Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is an example</p> <p>HTML and JAVASCRIPT CODE </p> <hr> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowExternalHtml.aspx.cs" Inherits="ShowExternalHtml" %&gt; </code></pre> <p></p> <p> Untitled Page</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; var XMLHttp = null; function Ajax() { if (window.XMLHttpRequest) { XMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { XMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return XMLHttp; } function OnStateChanged() { if ((XMLHttp.readyState == 4 || XMLHttp.readyState == "complete") &amp;&amp; XMLHttp.status == 200) { var value = XMLHttp.responseText ; alert(value); } } function FetchRawHtmlFromWebSites() { XMLHttp = Ajax(); if(XMLHttp != null ) { XMLHttp.onreadystatechange = OnStateChanged; var urlToOpen = 'HtmlProvider.aspx?Url=' + document.getElementById("txtUrlInput").value; try { XMLHttp.open("GET",urlToOpen,true); XMLHttp.send(null); } catch(e) { alert(e); } } } &lt;/script&gt; </code></pre> <p> </p> <pre><code> &lt;input type="text" id="txtUrlInput" name="txtUrlInput" /&gt; &lt;input type="button" value="Click this" onclick="FetchRawHtmlFromWebSites()" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p> </p> <p>Here is what you have to do int the server side. This example is with C#, could use any server side programming languages such as classical ASP, PHP PERL whatever.</p> <hr> <pre><code>using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net; using System.IO; public partial class HtmlProvider : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = Request.QueryString["Url"]; string result = string.Empty; if (!string.IsNullOrEmpty(url)) { string validUrl = string.Format("http://{0}", url); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(validUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); result = reader.ReadToEnd(); reader.Close(); } Response.Clear(); Response.ClearHeaders(); Response.Write(result); Response.End(); } } </code></pre> <p>I hope this example would be helpful to you</p>
 

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