Jump to content

How can get some string on web


Recommended Posts

You can use the _StringBetween() function, like this,

#include <String.au3>
Local $sString = '<p>String i want to get<span class="street">String i want to get</span></p>', _
      $sVar1 = _StringBetween($sString, '<p>', '<span class="street">'), _
      $sVar2 = _StringBetween($sString, '<span class="street">', '</span></p>')
ConsoleWrite($sVar1[0] & @LF & $sVar2[0] & @LF)

Look in the Help File for more info, and another example.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

if you want to go the xml parsing route, take the string of the xml, and pass it in:

$oXML=ObjCreate("Microsoft.XMLDOM")
$oXML.LoadXML('<p>String i want to geta<span class="street">String i want to getb</span></p>')
$result = $oXML.selectSingleNode('//p')
ConsoleWrite ( $result.childNodes.item(0).text & @CRLF)
ConsoleWrite ( $result.childNodes.item(1).text & @CRLF)

output would be:

String i want to geta

String i want to getb

this works for html as well, but then again, you can use the _IE* functions, and .innertext to do the same

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...