Author Topic: Retrieving and Parsing a web page  (Read 3864 times)

AnonymousPostings

  • Newbie
  • *
  • Posts: 49
Retrieving and Parsing a web page
« on: July 01, 2010, 10:02:28 AM »
i feel the need to further clearify my question on the web browser.
i did find how to show results of if a website exist.
but this doesn't seem to show the actual page, it dumped the source code into a text field.
(i was really looking to have something more like  the webcontrol from realbasic or even VB.)
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 415
  • Here to help you
Re: Retrieving and Parsing a web page
« Reply #1 on: July 01, 2010, 10:04:12 AM »
About a webcontrol, the best HN can currently do is to retrieve a web page and place it into a text file but it cannot display/render the webpage as RB can do.

Rendering a web page is a huge task and the URLexistsFN simply allows an HN program to retrieve then process a web page and look for specific data within it. Perhaps looking for tags and then extracting the data within those tags. In theory it is possible with the current version of HN to create your own algorithms to display simple web pages in a canvas but it would need a lot of programming.

Perhaps you have seen the HN Web Alarm project it also uses a the URLexistsFN to retrieve a file from the Tigabyte website..

this is the following of what i took out of my source code.
---
Code: [Select]
@This example finds your IP address using the website  'www.whatismyip.org'. If successful
@it puts the IP address number into field 1.

   Local webaddr,yield,timeout,filename,okay

   @ Set params for URLexists function
   HTTPSetHeaderName('User-Agent')
   HTTPSetHeaderValue('My Web Browser')
   Put 'http://www.msn.com/' into webaddr
   Put 1 into yield
   Put 30 into timeout
   Put 'webtext.txt' into filename

   Put URLexistsFN(webaddr,yield,timeout,filename) into okay

Put 'Loading' into field 1
   @ If okay then write IP to field 1
   If okay=1 Then
put '' into field 1
      Local h1,sdata
      OpenTReadLoc(filename,h1)
         ReadTLine(h1,sdata)
         Put sdata After field 1
      CloseTRead(h1)
   Else
      Put  'unsuccessful' into field 1
   EndIf
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.