Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Extract web page html code by given web page address

Posted on 2011-03-18
2
Medium Priority
?
323 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 600 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 1400 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

722 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