Page 1 of 1

how to get the code of the page with JavaScript?

Posted: Fri Jan 15, 2016 1:53 pm
by registrymechanic22
Hi

This code does not show the complete code of the page (without JavaScript):

Code: Select all

parserSite.s="http://bgp.he.net"
suffixSearch.s="/dns/"
suffixIpinfo.s="#_ipinfo"
search.s="facebook.com"
queryString.s = parserSite + suffixSearch + search + suffixIpinfo

Procedure.l DownloadToMem(URL.s, *lpRam, ramsize )
  Protected agent.s, hInet, hData, Bytes.l 
  agent.s = "Mozilla/5.0 (compatible; ST)" 
  hInet = InternetOpen_( @agent.s,0,0,0,0 ) 
  hData = InternetOpenUrl_( hInet, @URL.s, "", 0, $8000000, 0 ) 
  If hData > 0 : InternetReadFile_( hData, *lpRam, ramsize, @Bytes ) : Else : Bytes = -1 : EndIf 
  InternetCloseHandle_(hInet) 
  InternetCloseHandle_(hData) 
  ProcedureReturn Bytes
EndProcedure
 
MemSize=10240000 
Dim html.a(MemSize)

Size=DownloadToMem(queryString, @html(), MemSize)

Debug PeekS(@html(), Size, #PB_Ascii)
Is it possible to get the full code of the page? (as in the browser - right click - "view source code page")

Thanks.
Best regards.

Re: how to get the code of the page with JavaScript?

Posted: Thu Jan 21, 2016 12:09 pm
by deseven
What exactly do you mean?
You want to execute javascript first before getting the source code?
In that case the easiest way will be to use WebGadget() and grab the html with GetGadgetItemText(webgadget,#PB_Web_HtmlCode). However it's windows only and i'm not sure that the source code will be changed. Give it a try.

Re: how to get the code of the page with JavaScript?

Posted: Thu Jan 21, 2016 12:23 pm
by RSBasic

Re: how to get the code of the page with JavaScript?

Posted: Fri Jan 22, 2016 7:10 pm
by registrymechanic22
Hello!
Thank you for your interest in my question.

I want to get it:
http://bgp.he.net/dns/facebook.com

Code: Select all

<!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" xml:lang="en" lang="en">
<head>
<!-- rmosher 2010 - 2014 -->
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<script src="/javascripts/jquery/jquery-1.3.2.js?1235084520" type="text/javascript"></script>
<script src="/javascripts/jquery/jquery.history.js?1364589087" type="text/javascript"></script>
<script src="/javascripts/jquery/jquery-ui.js?1269850573" type="text/javascript"></script>
<script src="/javascripts/jquery/jrails.js?1269850578" type="text/javascript"></script>
<script src="/javascripts/bgp.js?1260526324" type="text/javascript"></script>
<link href="/stylesheets/bgp.css?1444893633" media="screen" rel="stylesheet" type="text/css" />


<script src="/javascripts/tabs.js?1364588335" type="text/javascript"></script>
<title>facebook.com - bgp.he.net</title>
<meta name="description" content="facebook.com DNS Information" />


</head>

<body>
	<div id='header'>
		<a href="http://www.he.net/"><img alt='Hurricane Electric' src='/helogo.gif'></img></a>
		<form action="/search" method="get">
			<div class='search'>
			<input id="search_search" name="search[search]" size="15" type="text" />
			<input name="commit" type="submit" value="Search" />
		</div>
		</form>
		
<h1><a href="/dns/facebook.com" rel="bookmark" title="facebook.com">facebook.com</a></h1>

		<div class='clear'></div>
		<div class='floatleft'>
			<div class='leftsidemenu'>
				<div class='menuheader'>Quick Links</div>
				<ul class='leftsidemenuitems'>
					<li><a href='http://bgp.he.net/'>BGP Toolkit Home</a></li>
					<li><a href="/report/prefixes">BGP Prefix Report</a></li>
					<li><a href="/report/peers">BGP Peer Report</a></li>
					<li><a href="/report/bogons">Bogon Routes</a></li>
					<li><a href="/report/world">World Report</a></li>
					<li><a href="/report/multi-origin-routes">Multi Origin Routes</a></li>
					<li><a href="/report/dns">DNS Report</a></li>
					<li><a href="/report/tophosts">Top Host Report</a></li>
					<li><a href="/report/netstats">Internet Statistics</a></li>
					<li><a href='http://lg.he.net/'>Looking Glass</a></li>
					<li><a href='http://networktools.he.net/'>Network Tools App</a></li>
					<li><a href='http://tunnelbroker.net/'>Free IPv6 Tunnel</a></li>
					<li><a href='http://ipv6.he.net/certification/'>IPv6 Certification</a></li>
					<li><a href='http://bgp.he.net/ipv6-progress-report.cgi'>IPv6 Progress</a></li>
					<li><a href='http://bgp.he.net/going-native.pdf'>Going Native</a></li>
					<li><a href='http://bgp.he.net/contact/'>Contact Us</a></li>
				</ul>
	
			</div>
			<div class='clear'></div>
			<div class='social'>
			
				<a href="/r/Twitter" title="Hurricane Electric on Twitter"><img alt="Hurricane Electric on Twitter" src="/images/twitter.png?1215539178" /></a>
			
				<a href="/r/Facebook" title="Hurricane Electric on Facebook"><img alt="Hurricane Electric on Facebook" src="/images/facebook.png?1215539178" /></a>
			
			</div>
		</div>
	</div>

	<div id='content'>
			
		

		



<ul class='tabmenu'>
    <li id='tab_dns'    class='tabmenuli'>DNS Info</li>
    <li id='tab_website' class='tabmenuli'>Website Info</li>
    <li id='tab_ipinfo'   class='tabmenuli'>IP Info</li>
    <li id='tab_whois'    class='tabmenuli'>Whois</li>
</ul>

<div class='clear'></div>

<div id='dns' class='tabdata hidden'>
	
		<div class='dnshead'>Start of Authority</div>
		<div class='dnsdata'>
			
				
					mname:		a.ns.facebook.com
					rname:		dns.facebook.com<br/>
					serial:		1453485863<br/>
					refresh:	7200
					retry:		1800<br/>
					expire:		604800
					minimum:	120
				
			
		</div>
	
	
	
		<div class='dnshead'>Nameservers</div>
		<div class='dnsdata'>
			<a href="/dns/a.ns.facebook.com" title="a.ns.facebook.com">a.ns.facebook.com</a>, <a href="/dns/b.ns.facebook.com" title="b.ns.facebook.com">b.ns.facebook.com</a>
		</div>
		
	
	
		<div class='dnshead'>Mail Exchangers</div>
		<div class='dnsdata'>
			<a href="/dns/msgin.vvv.facebook.com" title="msgin.vvv.facebook.com">msgin.vvv.facebook.com</a>(10)
		</div>	
	
	
	
		<div class='dnshead'>TXT Records</div>
		<div class='dnsdata'>
			
				
					v=spf1 redirect=_spf.facebook.com<br/>
				
				<br/>
			
		</div>
	
	
	
		<div class='dnshead'>A Records</div>
		<div class='dnsdata'>
			<a href="/ip/173.252.120.68" title="173.252.120.68">173.252.120.68</a>
		</div>
	

	
		<div class='dnshead'>AAAA Records</div>
		<div class='dnsdata'>
			<a href="/ip/2A03:2880:2130:7F20:FACE:B00C::25DE" title="2A03:2880:2130:7F20:FACE:B00C::25DE">2A03:2880:2130:7F20:FACE:B00C::25DE</a>
		</div>
	
	
	
</div>


<div id='website' class='tabdata hidden'>
	<b>Alexa Rank</b>: 2
	<div id='webthumbimg' class='webthumb'>
		
			<img alt="Web Page Preview" src="/webthumbs/f/a/facebook.com_720.png?1452133126" />
		
	</div>
</div>


<div id='ipinfo' class='tabdata hidden'>
	
		
		<a href="/ip/173.252.120.68" title="173.252.120.68">173.252.120.68</a> >
		<a href="/net/173.252.96.0/19" title="173.252.96.0/19">173.252.96.0/19</a> >
		<a href="/AS32934" title="AS32934 Facebook, Inc.">AS32934</a> >
		Facebook, Inc.<br/>
		
	
		
		<a href="/ip/2a03:2880:2130:7f20:face:b00c:0:25de" title="2a03:2880:2130:7f20:face:b00c:0:25de">2a03:2880:2130:7f20:face:b00c:0:25de</a> >
		<a href="/net/2a03:2880:2000::/36" title="2a03:2880:2000::/36">2a03:2880:2000::/36</a> >
		<a href="/AS32934" title="AS32934 Facebook, Inc.">AS32934</a> >
		Facebook, Inc.<br/>
		
		<a href="/ip/2a03:2880:2130:7f20:face:b00c:0:25de" title="2a03:2880:2130:7f20:face:b00c:0:25de">2a03:2880:2130:7f20:face:b00c:0:25de</a> >
		<a href="/net/2a03:2880::/32" title="2a03:2880::/32">2a03:2880::/32</a> >
		<a href="/AS32934" title="AS32934 Facebook, Inc.">AS32934</a> >
		Facebook, Inc.<br/>
		
	
</div>

<div id='whois' class='tabdata hidden'>
	<pre>
Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Server Name: FACEBOOK.COM.BRETLANDTRUSTMERCHANDISINGDEPART.COM
   IP Address: 69.63.176.11
   Registrar: GOOGLE INC.
   Whois Server: whois.rrpproxy.net
   Referral URL: http://domains.google.com

   Server Name: FACEBOOK.COM.DEMONSTRATING.WHOIS.ROISMAN.COM
   IP Address: 69.31.121.196
   Registrar: NETWORK SOLUTIONS, LLC.
   Whois Server: whois.networksolutions.com
   Referral URL: http://networksolutions.com

   Server Name: FACEBOOK.COM.DISABLE.YOUR.TIMELINE.NOW.WITH.THE.ORIGINAL.TIMELINE-REMOVE.NET
   IP Address: 8.8.8.8
   Registrar: ENOM, INC.
   Whois Server: whois.enom.com
   Referral URL: http://www.enom.com

   Server Name: FACEBOOK.COM.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
   IP Address: 209.126.190.70
   Registrar: PDR LTD. D/B/A PUBLICDOMAINREGISTRY.COM
   Whois Server: whois.PublicDomainRegistry.com
   Referral URL: http://www.PublicDomainRegistry.com

   Server Name: FACEBOOK.COM.LOVED.BY.WWW.SHQIPHOST.COM
   IP Address: 46.4.210.254
   Registrar: ONLINENIC, INC.
   Whois Server: whois.onlinenic.com
   Referral URL: http://www.OnlineNIC.com

   Server Name: FACEBOOK.COM.MORE.INFO.AT.WWW.BEYONDWHOIS.COM
   IP Address: 203.36.226.2
   Registrar: INSTRA CORPORATION PTY, LTD.
   Whois Server: whois.instra.net
   Referral URL: http://www.instra.com

   Server Name: FACEBOOK.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
   IP Address: 69.41.185.229
   Registrar: TUCOWS DOMAINS INC.
   Whois Server: whois.tucows.com
   Referral URL: http://www.tucowsdomains.com

   Domain Name: FACEBOOK.COM
   Registrar: MARKMONITOR INC.
   Sponsoring Registrar IANA ID: 292
   Whois Server: whois.markmonitor.com
   Referral URL: http://www.markmonitor.com
   Name Server: A.NS.FACEBOOK.COM
   Name Server: B.NS.FACEBOOK.COM
   Status: clientDeleteProhibited https://www.icann.org/epp#clientDeleteProhibited
   Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited
   Status: clientUpdateProhibited https://www.icann.org/epp#clientUpdateProhibited
   Status: serverDeleteProhibited https://www.icann.org/epp#serverDeleteProhibited
   Status: serverTransferProhibited https://www.icann.org/epp#serverTransferProhibited
   Status: serverUpdateProhibited https://www.icann.org/epp#serverUpdateProhibited
   Updated Date: 25-aug-2015
   Creation Date: 29-mar-1997
   Expiration Date: 30-mar-2020

>>> Last update of whois database: Thu, 21 Jan 2016 19:10:02 GMT <<<

For more information on Whois status codes, please visit
https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en.

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar.  Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability.  VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.
Domain Name: facebook.com
Registry Domain ID: 2320948_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com
Updated Date: 2015-08-25T12:15:13-0700
Creation Date: 1997-03-28T21:00:00-0800
Registrar Registration Expiration Date: 2020-03-29T21:00:00-0700
Registrar: MarkMonitor, Inc.
Registrar IANA ID: 292
Registrar Abuse Contact Email: abusecomplaints@markmonitor.com
Registrar Abuse Contact Phone: +1.2083895740
Domain Status: clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)
Domain Status: clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)
Domain Status: clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)
Domain Status: serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)
Domain Status: serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)
Domain Status: serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)
Registry Registrant ID: 
Registrant Name: Domain Administrator
Registrant Organization: Facebook, Inc.
Registrant Street: 1601 Willow Road, 
Registrant City: Menlo Park
Registrant State/Province: CA
Registrant Postal Code: 94025
Registrant Country: US
Registrant Phone: +1.6505434800
Registrant Phone Ext: 
Registrant Fax: +1.6505434800
Registrant Fax Ext: 
Registrant Email: domain@fb.com
Registry Admin ID: 
Admin Name: Domain Administrator
Admin Organization: Facebook, Inc.
Admin Street: 1601 Willow Road, 
Admin City: Menlo Park
Admin State/Province: CA
Admin Postal Code: 94025
Admin Country: US
Admin Phone: +1.6505434800
Admin Phone Ext: 
Admin Fax: +1.6505434800
Admin Fax Ext: 
Admin Email: domain@fb.com
Registry Tech ID: 
Tech Name: Domain Administrator
Tech Organization: Facebook, Inc.
Tech Street: 1601 Willow Road, 
Tech City: Menlo Park
Tech State/Province: CA
Tech Postal Code: 94025
Tech Country: US
Tech Phone: +1.6505434800
Tech Phone Ext: 
Tech Fax: +1.6505434800
Tech Fax Ext: 
Tech Email: domain@fb.com
Name Server: a.ns.facebook.com
Name Server: b.ns.facebook.com
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2016-01-21T11:00:15-0800 <<<

The Data in MarkMonitor.com's WHOIS database is provided by MarkMonitor.com for
information purposes, and to assist persons in obtaining information about or
related to a domain name registration record.  MarkMonitor.com does not guarantee
its accuracy.  By submitting a WHOIS query, you agree that you will use this Data
only for lawful purposes and that, under no circumstances will you use this Data to:
 (1) allow, enable, or otherwise support the transmission of mass unsolicited,
     commercial advertising or solicitations via e-mail (spam); or
 (2) enable high volume, automated, electronic processes that apply to
     MarkMonitor.com (or its systems).
MarkMonitor.com reserves the right to modify these terms at any time.
By submitting this query, you agree to abide by this policy.

MarkMonitor is the Global Leader in Online Brand Protection.

MarkMonitor Domain Management(TM)
MarkMonitor Brand Protection(TM)
MarkMonitor AntiPiracy(TM)
MarkMonitor AntiFraud(TM)
Professional and Managed Services

Visit MarkMonitor at http://www.markmonitor.com
Contact us at +1.8007459229
In Europe, at +44.02032062220

For more information on Whois status codes, please visit
 https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en
--
</pre>
</div>



	</div>
	
	<div id='footer'>
	Updated 22 Jan 2016 09:06 PST &copy; 2016 Hurricane Electric
	</div>
	
	<script type="text/javascript">
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	</script>
	<script type="text/javascript">
		try {
			var pageTracker = _gat._getTracker("UA-12276073-1");
			pageTracker._trackPageview();
		} catch(err) {}
	</script>
</body>
</html>
[/size]
I'm sorry, on the forum there is no [spoiler=][/spoiler] :oops:

Re: how to get the code of the page with JavaScript?

Posted: Fri Jan 22, 2016 7:11 pm
by registrymechanic22
Hello!
Thank you for example
but, not work :(

Code: Select all

;Autor: freak

EnableExplicit

Procedure WebGadget_Document(Gadget, *IID)
  Protected Document = 0
  Protected Browser.IWebBrowser2
  Protected DocumentDispatch.IDispatch
  
  Browser.IWebBrowser2 = GetWindowLongPtr_(GadgetID(Gadget), #GWL_USERDATA)
  If Browser
    If Browser\get_Document(@DocumentDispatch.IDispatch) = #S_OK And DocumentDispatch
      DocumentDispatch\QueryInterface(*IID, @Document)
      DocumentDispatch\Release()
    EndIf
  EndIf     
  
  ProcedureReturn Document
EndProcedure

Procedure.s WebGadget_PageHtml(Gadget)
  Protected Result$ = ""
  Protected Document.IHTMLDocument3
  Protected Root.IHTMLElement
  Protected bstr_html
  
  Document.IHTMLDocument3 = WebGadget_Document(Gadget, ?IID_IHTMLDocument3)
  If Document
    If Document\get_documentElement(@Root.IHTMLElement) = #S_OK
      If Root\get_outerHTML(@bstr_html) = #S_OK And bstr_html
        Result$ = PeekS(bstr_html, -1, #PB_Unicode)
;   Debug     Result$
        SysFreeString_(bstr_html)
      EndIf
      
      Root\Release()
    EndIf                       
    Document\Release()
  EndIf         
  
  ProcedureReturn Result$
EndProcedure

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  WebGadget(1, 0, 0, WindowWidth(0), WindowHeight(0)-40, "http://bgp.he.net/dns/facebook.com")
  ButtonGadget(2, WindowWidth(0)-110, WindowHeight(0)-30, 100, 20, "HTML ermitteln", 0)
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 2
            Debug WebGadget_PageHtml(1)
        EndSelect
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf

DataSection
  IID_IHTMLDocument2: ; {332C4425-26CB-11D0-B483-00C04FD90119}
  Data.l $332C4425
  Data.w $26CB, $11D0       
  Data.b $B4, $83, $00, $C0, $4F, $D9, $01, $19
  IID_IHTMLDocument3: ; {3050F485-98B5-11CF-BB82-00AA00BDCE0B}
  Data.l $3050F485
  Data.w $98B5, $11CF
  Data.b $BB, $82, $00, $AA, $00, $BD, $CE, $0B
  IID_NULL: ; {00000000-0000-0000-0000-000000000000}
  Data.l $00000000
  Data.w $0000, $0000
  Data.b $00, $00, $00, $00, $00, $00, $00, $00
EndDataSection
[/size]
"<HTML><HEAD><TITLE>bgp.he.net</TITLE></HEAD>
<BODY>bgp.he.net requires javascript and cookies to function. Please enable these in your browser. </BODY></HTML>
"