Jump to content

Get link from webpage source


Recommended Posts

<td><input type="checkbox" name="emailTable:0:j_id29" checked="checked" disabled="disabled" /></td>
<td><a href="/linktoit/index.html?dataModelSelection=message%3Aemails%5B0%5D&amp;actionMethod=index.xhtml%3AmailQueue.select" id="emailTable:0:j_id35">Confirmation code: oO6aI2Nq5m</a></td>
   Oct 16, 2011 10:51:08 AM</td>

I am trying to make a function that will get this and return it


I have tried this function but it doesn't work

I know it doesn't do what I want but I was taking baby steps and still couldn't figure it out, any help would be greatly appreciated.


Func GetEmail()
$page = _INetGetSource('http://workcomputer.com/mail/')
$pageArray = StringSplit($page, @CRLF)
For $i = 1 To $pageArray[0]
    If StringInStr($pageArray[$i], "user@yahoo.com") Then MsgBox(0, "Found it", $pageArray[$i])
Link to comment
Share on other sites

Try using the _StringBetween() function, maybe like this..

#include <String.au3>
$a = "<a href='/linktoit/index.html?dataModelSelection=message%3Aemails%5B0%5D&amp;actionMethod=index.xhtml%3AmailQueue.select' id='emailTable:0:j_id35'>Confirmation code: oO6aI2Nq5m</a>"
$b  = _StringBetween($a, "<a href='", "' id='")
MsgBox(0, "", $b[0])

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

Link to comment
Share on other sites

the function I posted does not find the user@yahoo.com in the source

I can find it perfectly fine, there are a few functions in your function, which one is not returning a value you expect?

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

$pageArray = StringSplit($page, @CRLF)
For $i = 1 To $pageArray[0]
    If StringInStr($pageArray[$i], "Confirmation code:") Then
  MsgBox(0, "Found it", $pageArray[$i])
        $b  = _StringBetween($pageArray[$i], "Confirmation code: ", "</a>")
  MsgBox(0, "Found it", $b[0])

this piece of code works for anybody that will be trying to do this in the future, thank you all

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

  • Recently Browsing   0 members

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