Solved

Extract web page html code by given web page address

Posted on 2011-03-18
2
317 Views
Last Modified: 2012-08-13
Hi, suppose a web page link is given. Can I get the page source code?
For example:
 http://www.experts-exchange.com/

Open in new window

is given than the html code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
  // <![CDATA[
  var eeTimerStart = new Date().getTime();
  var eeTimerCnt = 0;
  var eeAdsLoaded = 0;
  var ourMs = 0;
  var adMs = 0;
  
  function eeEncode(str)
  {
     str = escape(str);
     str = str.replace('+', '%2B');
     str = str.replace('%20', '+');
     str = str.replace('*', '%2A');
     str = str.replace('/', '%2F');
     str = str.replace('@', '%40');
     return str;
  }
  
  function endEETimer()
  {
      if (++eeTimerCnt == 4) {
         ourMs = (new Date().getTime() - eeTimerStart);
         eeTimerStart = new Date().getTime();
      
      } 
      if (eeTimerCnt == 5 && eeAdsLoaded == 1) {
         adMs = (new Date().getTime() - eeTimerStart);
         eeTimerStart = new Date().getTime();
      }
      if (eeTimerCnt == 6) {
         var omnitureMs = (new Date().getTime() - eeTimerStart);
         var img = document.createElement("img");
         img.src="/pageLoaded.jsp?url=" + eeEncode(document.location.href) + 
                 "&isNew=0" +
                 "&adMs=" + adMs + "&ourMs=" + ourMs + "&omnitureMs=" + omnitureMs + 
                 "&isSecure=0" + 
                 "&isExpertSkin=0" + 
                 "&isVS=0" + 
                 "&isUsingCDN=0" +
                 "&isUsingEELevel3CDN=1" +
                 "&isUsingEEDigitalWestCDN=0" +
                 "&isConsolidatedCSS=1"; 
         

         document.body.appendChild(img)
 

      }
  }
 
  // ]]>
  </script>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="/images/ee.ico" type="image/x-icon" />

<style type="text/css">@import "http://images.experts-exchange.com/getCSS?key=/00206/ee_NS|--base,xp--base,--component,xp--component,--formFactory,xp--formFactory,xp--button,xp-include-infoBox&t=1299910051000";</style>
<style type="text/css">@import "http://images.experts-exchange.com/getCSS?key=/00206/ee_NS|-jsp-indexLoggedIn,xp-jsp-indexLoggedIn,-include-questionList,xp-include-questionList,xp-include-searchForAnswers,xp-include-welcomeGuide,xp-include-corpAd,xp-include-rootTAHeader,xp-include-updateMessage,-include-questionSubmitted,xp-include-questionSubmitted,-include-codeSnippet,xp-include-codeSnippet,-include-question,xp-include-question,-include-customEEple,xp-include-customEEple,xp-include-ranks,xp-include-qualifiedExpertMessage,xp-include-outsideBookmarks,xp-include-welcomeQuestion,xp-include-questionScore,xp-include-findYourSolution,xp-include-recentActivityFeed,xp-include-actionBox,-include-corpAdBannerLI,xp-include-corpAdBannerLI,-include-expertZoneOverlay,xp-include-expertZoneOverlay,-include-welcomeBottomOverlay,xp-include-welcomeBottomOverlay&t=1299910051000";</style>
<script src="http://images.experts-exchange.com/00206/scripts/eeSubs_8fd303295f70c1423099a23823d4f8ba.js" type="text/javascript"></script>
<meta name="alexaVerifyID" content="EEyq-1NAv4sP8nJvMcuCYJ4YqjU" />
  <meta name="msvalidate.01" content="19C984E796A6C2E12B5745B0A771521A" />
<title>Experts Exchange</title>
<link rel="alternate" type="application/atom+xml" title="Experts Exchange Articles" href="/articleFeed.jsp" />
<link rel="alternate" type="application/atom+xml" title="Experts Exchange Questions" href="/questionFeed.jsp" />
<script src="http://images.experts-exchange.com/00206/scripts/s_code_0a522bfb0687449fe5b609a65bced569.js" type="text/javascript"></script> </head>
<body style="height: 100%;" class="IE8" >

 <div id="minWidth"></div>
<div class="outerBodyWrap indexLoggedInJSP">
  <div class="bodyWrap">
  <div id="outerWrap">
   <div id="innerWrap" class="innerWrap" style="">
   <div id="pageHeader"
      >
        <!-- top options -->
        <ul class="navTopOptions">
<!--   many many lines available

Open in new window

0
Comment
Question by:zhshqzyc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Assisted Solution

by:tonykachappilly
tonykachappilly earned 150 total points
ID: 35167779
http://www.codeproject.com/KB/aspnet/ZetaWebSpider.aspx
check this link u'll get a solution
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 350 total points
ID: 35167810
You can use something like this:

var client = new System.Net.WebClient ();
string content = string.Empty;

client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

using (Stream data = client.OpenRead ("http://www.experts-exchange.com/"))
{
	using (StreamReader reader = new StreamReader (data))
	{
		content = reader.ReadToEnd ();
		Console.WriteLine (content);
	}
}

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
Do I need to force my browser to see my new Favicon 4 48
Load XML element 3 43
Undefined variable with $_POST in PHP 5 38
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question