Hey,
I have an website with dynamic text on it, i want to transfer the text to an textbox,
and the text is between this tags:
<pre>
</pre>
How do i do this?
killerbeat 0 Newbie Poster
killerbeat 0 Newbie Poster
Hey, codeorder
1. I'm using an webbrowser, but a webrequest will work to
2. Yes, the text changes but is in the page source
codeorder 197 Nearly a Posting Virtuoso
Is it possible to post the Html source code from the web-page?
If too much code to add in this thread, send me a private message with the Html source code and bold out or highlight the area of content you want to retrieve.
killerbeat 0 Newbie Poster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Networktools: reverseip google.nl - Reverse IP Lookup, Whois, Ping, RBL Check, DNS Records, Traceroute, Host information</title>
<meta name="description" content="Network information tools; reverseip google.nl query whois records, ping hosts, query dns records, trace hosts, display host information, domains on ip, reverse ip, check spam blacklist, rbl check">
<meta name="keywords" content="networktools reverseip google.nl networktools network network tool network tools whois domain domains dns domain name ping traceroute host dns zone dns records reverse ip rbl check spam blacklist check">
<meta name="google-site-verification" content="0iZo5eSZbvygFjlVJLJJwekwfqNWtiSMyeAdnXZq6JE" />
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<link rel="stylesheet" type="text/css" href="/css/main.css" media="screen" />
<link rel="alternate" type="application/atom+xml" title="Networktools - Atom" href="http://networktoolsblog.blogspot.com/feeds/posts/default" />
<link rel="alternate" type="application/rss+xml" title="Networktools - RSS" href="http://networktoolsblog.blogspot.com/feeds/posts/default?alt=rss" />
<link type="text/css" href="/css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=networktools"></script>
<!--[if lt IE 7]>
<script defer type="text/javascript" src="/js/pngfix.js"></script>
<![endif]-->
<!--[if lte IE 8]><link rel="stylesheet" type="text/css" href="/css/ie8-main.css" /><![endif]-->
<link rel="Shortcut Icon" href="/favicon.ico">
</head>
<body bgcolor="#333333" link="#ff5500" vlink="#ff5500" alink="#ff0000">
<center>
<div id="contentWrapper">
<div id="contentHeader">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="80%">
<a href="/">
<img src="/img/network.png"/>
<img src="/img/networktools.png"></img>
</a>
</td>
</tr>
</table>
</div>
<div id="toolContent">
<noscript>
<div style='font-size: 15px;'>
<b>Hi, you have JavaScript turned off. This website needs JavaScript to function properly.</b>
</div>
</noscript>
<div style='float:right;' onclick="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()">
<a href="javascript:;" title='Bookmark & Share'><img src='/img/addthis.gif' /></a>
</div>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td>
<table border='0'>
<tr>
<td id="toolWhois" class="tool" title='Query whois records'>
<input type='radio' name='toolType' />
<font><b>Whois</b></font>
</td>
<td id="toolPing" class="tool" title='Ping hosts'>
<input type='radio' name='toolType' />
<font><b>Ping</b></font>
</td>
<td id="toolDNS" class="tool" title='Query dns records'>
<input type='radio' name='toolType' />
<font><b>DNS Zone</b></font>
</td>
<td id="toolTraceroute" class="tool" title='Trace hosts'>
<input type='radio' name='toolType' />
<font><b>Traceroute</b></font>
</td>
<td id="toolHost" class="tool" title='Display host information'>
<input type='radio' name='toolType' />
<font><b>Host</b></font>
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td id="toolReverseIP" class="tool" colspan="1" title='Show domains on an IP address'>
<input type='radio' name='toolType' checked />
<font><b>Reverse IP</b></font>
</td>
<td id="toolRBLCheck" class="tool" colspan="1" title='Checks whether an IP address is listed in SPAM blacklists'>
<input type='radio' name='toolType' />
<font><b>RBL Check</b></font>
</td>
<td id="toolASInfo" class="tool" colspan="1" title='Shows information on Autonomous Systems'>
<input type='radio' name='toolType' />
<font><b>AS Info</b></font>
</td>
<td id="toolServices" class="tool" colspan="1" title='Shows active services on a host and information related to the services (comparable to a portscan)'>
<input type='radio' name='toolType' />
<font><b>Services</b></font>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td align="left" valign="top" width="750" colspan="3">
<table id="submitTable">
<tr>
<td align="center">
<form id="toolSubmitInput" action="/actionhandler" method="POST">
<input id="toolAction" type="hidden" name="toolAction">
<tr>
<td><input id="toolInput" name="toolInput" type="text" class="textInput" name="ip" size="40" value="google.nl"></td>
<td colspan="3" align="right">
<input type="submit" class="button" value="Go!" style='width: 50px;height: 40px;'>
<!--<input type="image" src='/img/querybutton.png' style='margin-top: 2px;' title='Search!' />-->
</td>
</tr>
<tr>
<td>
<script type="text/javascript">
google_ad_client = "pub-0305511562035867";
google_ad_slot = "8813106053";
google_ad_width = 468;
google_ad_height = 60;
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</td>
</tr>
</form>
</td>
</tr>
</table>
<pre>
Domains on <b>74.125.79.147</b>:
74.125.79.147
www.karmats.net
alt1.toolbarqueries.google.es
alt1.toolbarqueries.google.co.uk
picasa.google.se
</pre>
</td>
</tr>
</table>
</div>
<div id='footerContent'>
© 2010 FY. All rights reserved.
| <a href='' title='Random search'>Random</a>
| <a id='newToolLink' href='javascript:;'>Request a new tool</a>
<!-- | <a id='feedbackLink' href='javascript:;'>Feedback</a>-->
| <a id='blogLink' href='http://networktoolsblog.blogspot.com/' target="_blank">Blog</a>
: <a href='http://networktoolsblog.blogspot.com/2010/08/top-searches-08aug2010-part4.html' target='_blank' title='Latest blog entry'>Top searches (08/Aug/2010) Part4</a>
<br />Also available at
<a href='http://mx-records.net' title='mx-records.net'>mx-records.net</a>
<a href='http://ip-reverse-lookup.com' title='ip-reverse-lookup.com'>ip-reverse-lookup.com</a>
<a href='http://dns-records.info' title='dns-records.info'>dns-records.info</a>
<a href='http://rbl-check.info' title='rbl-check.info'>rbl-check.info</a>
<a href='http://dnsbl.nl' title='dnsbl.nl'>dnsbl.nl</a>
<br />
Your IP address is 85.144.248.123
<!--<a href="http://coverproxy.com" target="_blank" style="float: right;margin-top: -30px;margin-right: 40px;" title="Try Cover Proxy! Cover Proxy is a web proxy for keeping yourself anonymous and bypassing network restrictions.">
<img src="/img/coverproxy_new.png" border="0" />
</a>-->
<br />
<u>Linkpartners:</u> <a href="http://coverproxy.com" target="_blank">coverproxy.com</a> | <a href="http://warpproxy.com" target="_blank">warpproxy.com</a> |
<a href="http://awesomeproxy.com" target="_blank">awesomeproxy.com</a> | <a href="http://stegoproxy.com" target="_blank">stegoproxy.com</a> |
<a href="http://prxy.eu" target="_blank">prxy.eu</a> | <a href="http://swapip.com" target="_blank">swapip.com</a>
| <a href="http://rapidprivacy.com" target="_blank">rapidprivacy.com</a>
| <a href="http://rockhopped.com" target="_blank">rockhopped.com</a>
<br />
<!--<u>Advertisement:</u>
| <a href="http://www.vakantiekrant.nl/reisaanbod/?tt=2794_98804_57048_&r=" target="_blank">Last-minutes</a>
| <a href="http://www.vakantiekrant.nl/reisaanbod/?tt=2794_98802_57048_&r=" target="_blank">Hotels</a>
| <a href="http://www.vdx.nl/tt/?tt=1659_42676_57048_&r=" target="_blank">Linux PHP webhosting</a>
<br />-->
<script type="text/javascript">
google_ad_client = "pub-0305511562035867";
google_ad_slot = "8813106053";
google_ad_width = 468;
google_ad_height = 60;
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<div id="newToolDialog" title="Request a new tool" style='display: none;'>
<table>
<tr>
<td valign="top">Tool name: </td>
<td><input id="newToolName" type="text" size="25" class="textInput" /></td>
</tr>
<tr>
<td valign="top">E-mail: </td>
<td><input id="newToolEmail" type="text" size="25" class="textInput" /></td>
</tr>
<tr>
<td valign="top">Description: </td>
<td><textarea id="newToolDescription" rows="5" cols="23" class="textAreaInput"></textarea></td>
</tr>
</table>
</div>
<div id="feedbackDialog" title="Feedback" style='display: none;'>
<table>
<tr>
<td valign="top">E-mail: </td>
<td><input id="feedbackEmail" type="text" size="25" class="textInput" /></td>
</tr>
<tr>
<td valign="top">Comments: </td>
<td><textarea id="feedbackComments" rows="5" cols="26" class="textAreaInput"></textarea></td>
</tr>
</table>
</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-12756464-1");
pageTracker._trackPageview();
} catch(err) {}</script>
<script type="text/javascript">
var uservoiceOptions = {
key: 'networktools',
host: 'networktools.uservoice.com',
forum: '51911',
alignment: 'right',
background_color:'#f00',
text_color: 'white',
hover_color: '#06c',
lang: 'en',
showTab: true
};
function _loadUserVoice() {
var s = document.createElement('script');
s.src = ("https:" == document.location.protocol ? "https://" : "http://") + "uservoice.com/javascripts/widgets/tab.js";
document.getElementsByTagName('head')[0].appendChild(s);
}
_loadSuper = window.onload;
window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); };
</script>
</body>
</html>
The piece of code:
<pre>
Domains on <b>74.125.79.147</b>:
74.125.79.147
[url]www.karmats.net[/url]
alt1.toolbarqueries.google.es
alt1.toolbarqueries.google.co.uk
picasa.google.se
</pre>
codeorder 197 Nearly a Posting Virtuoso
Let me know if this helps.
No WebBrowser needed.
'//--- THIS FILE WILL BE REMOVED FROM MY WEBSITE ONCE THREAD IS SOLVED ---\\
Dim linkUrl As String = "http://www.codeorder.net/files/tempTestFile.html" '//-- used for testing only.
'//--- THE FILE CONTENT IN THE LINK ABOVE IS EXACTLY THE CONTENT PREVIOUSLY POSTED BY "killerbeat" ---\\
Try
Dim myResponse As Net.HttpWebResponse = Net.HttpWebRequest.Create(linkUrl).GetResponse '// connect.
Dim myStream As IO.Stream = myResponse.GetResponseStream() '// get.
Dim myReader As New IO.StreamReader(myStream) '// read.
Dim myWebFileInfo As String = myReader.ReadToEnd '// get innerHtml of Page.
'// close reader, information stream, and connection.
myReader.Close() : myStream.Close() : myResponse.Close()
'// get location of <pre> by index.
Dim myStartIndex As Integer = myWebFileInfo.IndexOf("<pre>") + 5 '// add +5 to not add "<pre>" to final result.
'// get location of </pre> by index.
Dim myEndIndex As Integer = myWebFileInfo.IndexOf("</pre>")
'// subtract to get a total number for the substring length result.
Dim myStringLengthToExtract As Integer = myEndIndex - myStartIndex
'// display result.
MsgBox(myWebFileInfo.Substring(myStartIndex, myStringLengthToExtract), MsgBoxStyle.Information, "...codeorder...")
Catch ex As Exception
MsgBox("Connection Error.", MsgBoxStyle.Critical, "myCool Error Message")
End Try
killerbeat 0 Newbie Poster
A Really big thanks, codeorder
Theres only one problem left:
I want to display the text into an textbox called "ipinfo"
when i do it like this:
ipinfo.text = myWebFileInfo.Substring(myStartIndex, myStringLengthToExtract)
it is one big mess
codeorder 197 Nearly a Posting Virtuoso
:)
Try this modification.
'//--- THIS FILE WILL BE REMOVED FROM MY WEBSITE ONCE THREAD IS SOLVED ---\\
Dim linkUrl As String = "http://www.codeorder.net/files/tempTestFile.html" '//-- used for testing only.
'//--- THE FILE CONTENT IN THE LINK ABOVE IS EXACTLY THE CONTENT PREVIOUSLY POSTED BY "killerbeat" ---\\
Try
Dim myResponse As Net.HttpWebResponse = Net.HttpWebRequest.Create(linkUrl).GetResponse '// connect.
Dim myStream As IO.Stream = myResponse.GetResponseStream() '// get.
Dim myReader As New IO.StreamReader(myStream) '// read.
Dim myWebFileInfo As String = myReader.ReadToEnd '// get innerHtml of Page.
'// close reader, information stream, and connection.
myReader.Close() : myStream.Close() : myResponse.Close()
'// get location of <pre> by index.
Dim myStartIndex As Integer = myWebFileInfo.IndexOf("<pre>") + 5 '// add +5 to not add "<pre>" to final result.
'// get location of </pre> by index.
Dim myEndIndex As Integer = myWebFileInfo.IndexOf("</pre>")
'// subtract to get a total number for the substring length result.
Dim myStringLengthToExtract As Integer = myEndIndex - myStartIndex
'// extract string.
myWebFileInfo = myWebFileInfo.Substring(myStartIndex, myStringLengthToExtract)
'// split into string arrays.
Dim myHtmlTextLines() As String = myWebFileInfo.Split(vbNewLine.ToCharArray)
'// display result.
For Each line As String In myHtmlTextLines '// loop thru each line.
If Not line.StartsWith(" ") Then '// do not add empty lines.
If TextBox1.Lines.Length = 0 Then
TextBox1.Text &= line & vbNewLine & vbNewLine '// add an empty line after line 1.
Else
TextBox1.Text &= line & vbNewLine
End If
End If
Next
'// remove HTML formatting.
With TextBox1 : .Text = .Text.Replace("<b>", "") : .Text = .Text.Replace("</b>", "") : End With
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "myCool Error Message")
End Try
Gerald12 0 Newbie Poster
Hi, Just wanted to say thanks for the code. I modified it to grab any text between <td> and </td> tags.
sparq 0 Newbie Poster
This is very cool. Any way to modify this so that it can batch process a list of URLs? i.e. copy/paste a list of urls into a textbox and have your code loop for each url and spit out results per line into another text box or file?
codeorder 197 Nearly a Posting Virtuoso
>>This is very cool...
Then start your own thread And Not spam someone else's thread. Sucks not to be able to edit past 30min., right?:D
fiaworkz -3 Newbie Poster
I got the same problem! but i need to use regex. does anyone know how I can fix my codes using regex?
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.