PowerTCP Web Enterprise for ActiveX | WebPage Object

PowerTCP Web Enterprise for ActiveX Features

WebPage Object

The WebPage object is used to represent an HTML page for parsing and resource collecting.

Features include:

  • Full integration with the WebASP control - get a page and parse it
  • Get all images, links, meta-content, or other HTML resource on a page
  • Parse locally saved HTML documents
  • Powerful HTML table parsing (such as grabbing the value of a cell)
  • Find content between two tokens

 

 

 

Code Example

How easy is the WebPage object to use? Check out the following VB example below, which demonstrates getting and saving all images on a web page.

 

'WebPage object to use for parsing
Dim WebPage1 As New WebPage
Dim blnResult As Boolean

'Set Request url
WebASP1.Request.Url = "www.dart.com"

'Get the page
WebASP1.Get

'Set webpage source to html source from Response
WebPage1.Source = WebASP1.Response.Body.ReadString

'Iterate through WebResources, be sure to set WebPage.UrlHost first
WebPage1.UrlHost = WebASP1.Request.Url
For i = 1 To WebPage1.Resources.Count
If WebPage1.Resources.Item(i).UrlType = resImg Then
'This WebResource is an image, so write to file
blnResult = WebPage1.Resources(i).Get("C:\temp\img", True, 30000)
If blnResult = True Then
List1.AddItem WebPage1.Resources(i).UrlName & " is saved"
End If
End If
Next