Jump to content

Get link from webpage source


Recommended Posts

<tbody>
<tr>
<td><input type="checkbox" name="emailTable:0:j_id29" checked="checked" disabled="disabled" /></td>
<td>
   user@yahoo.com</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>
<td>
   </td>
<td>
   Oct 16, 2011 10:51:08 AM</td>
</tr>
</tbody>
</table>

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

/linktoit/index.html?dataModelSelection=message%3Aemails%5B0%5D&amp;actionMethod=index.xhtml%3AmailQueue.select

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.

Thanks

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])
Next
 
EndFunc
Link to post
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 post
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 post
Share on other sites

$page=_INetGetSource("http://pagelink")
$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])
  EndIf
 
Next

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

Link to post
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...