Jump to content



Photo

Reading from a webpage


  • Please log in to reply
5 replies to this topic

#1 Athos

Athos

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 27 June 2012 - 02:00 PM

Hi Guys, I'm trying to find a way to collect data from a webpage using IE.

I already know about _IEBodyReadText($oIE) but the problem is, I just want a specific instance of that text without getting all of it.


What I want to be able to do, is to read that text line by line, and when I find a specific string on the line I want, I want to be able to print out that entire line.


The problem for me is that It _IEBodyReadText formats the text into one big string, so I would have to use split string to accomplish this task. The problem with that is, there are no lines, so I don't know how I would write something like,

if substring=Cluster read untill you reach .com, and let that be the substring....


Should I tackle this problem that way, or should I find a way to get the substring I want from the HTML itself?



Thanks,


Athos







#2 zorphnog

zorphnog

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 445 posts

Posted 27 June 2012 - 02:06 PM

Do you have an example of the html and the text that you want? There are other _IE functions that can return specific elements of the DOM, but without knowing the specifics it is hard to recommend a solution.

#3 Athos

Athos

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 27 June 2012 - 02:13 PM

Sure thing. This is from the html source (note I modded it again to protect the data)

<tr><td>&amp;nbsp;</td><td><font class="f-body">This is the body of text taht I want to avoid </font></td></tr>
<tr><td>&amp;nbsp;</td><td>
<font class="f-navbar">Cluster Host = </font><font class='f-body'>
something.com</font>
I want to get Cluster host and the something.com in 1 string. That or just the something.com would be good.

Edited by Athos, 27 June 2012 - 02:14 PM.


#4 water

water

    ?

  • MVPs
  • 10,696 posts

Posted 27 June 2012 - 02:15 PM

Use function_IETableWriteToArray to retrieve the content of the table. You then can loop through the array and search for your data.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#5 Athos

Athos

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 27 June 2012 - 02:29 PM

Thanks so much water! _IETable was great, because from the array, I could just specify the column and row I wanted. :D

Edited by Athos, 27 June 2012 - 02:31 PM.


#6 water

water

    ?

  • MVPs
  • 10,696 posts

Posted 27 June 2012 - 02:34 PM

Glad to be of service :D

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users