Sign in to follow this  
Followers 0
Jack023

Get a part outside a html file.

5 posts in this topic

Hey all,

I'm trying to get a part outside a html file :

I tried stringregexp but i don't get it, maybe easier ways?

Here is the code:

$url = "http://www.mysite.com/"

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
; or :
; $oHTTP = ObjCreate("Microsoft.XMLHTTP")
$oHTTP.Open("GET", $url, 0)
$oHTTP.Send()
$txt = $oHTTP.Responsetext
$oHTTP = 0
$return = StringRegExp($txt, 'cols=60 wrap>(.*?)<textarea><form')
;~ MsgBox(0, "" , $txt)
MsgBox(0, "", $return)

It's something diffrent then my other thread and has nothing to do with it ;)

Just a little note.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello.

It would be easier if you could paste some html code - the part you want to extract the data from.

And please write what this code shows in msgbox.

Edited by karlkar

Share this post


Link to post
Share on other sites

It's showing the html code of the page.

</p>D S Technical Solutions A Plus Core Test Pro 3.3f14<br><br><textarea rows=8 cols=59>s/n: 12022002
s/n: 12022002</textarea><br><form action="/abuse.php" method="post" target="_blank"><input type="hidden" name="id" value="18851777"><input type="hidden" name="serialname" value="D S Technical Solutions A Plus Core Test Pro 3.3f14"><input type="submit" name="send" value="Send Abuse"></form><BR><BR><BR>
<center>Copyright Serials.BE c 2006, All rights reserved.</center>

Like as a example, i want the things between cols=59?s/n: and </textarea>

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok. You can try doing as you have tried, but with a little change: 

$return = StringRegExp($txt, 'cols=\d+>(.*?)</textarea>', 1)
MsgBox(0, "", $return[0])

StringRegExp without second parameter returns only 0 or 1 if it found text that match regular expression. Second parameter set to 1 makes it return Array of matches. You can read about it in docs.

You can also use different regexp:

<textarea.*>(.*?)</textarea>
Edited by karlkar

Share this post


Link to post
Share on other sites

works thanks :)

Share this post


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
Sign in to follow this  
Followers 0