Sign in to follow this  
Followers 0
MaoMao

How to collect data in web page search engine

3 posts in this topic

#1 ·  Posted (edited)

Can anyone help for how to submit a web site search function.

Need to enter multiple info to search engine.

Display result in message page for further use.

;Get the html code of the results page
#include <IE.au3>
#include <String.au3>
Local $Keyword = 'Chrome'
Local $Keyword1 = 'Windows'
Local $Keyword2 = 'download'
; Example Site: Local $SearchEngine = 'http://www.ebay.com/sch/ebayadvsearch/?_skipfnorm=1&rt=nc'
; Example Site: Local $SearchEngine = 'http://www.hotels.com/'   

; Program loop get info from web page
Local $SearchEngine = 'http://www.google.com/advanced_search?hl=en'
$oIE = _IECreate($SearchEngine)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)   ; submit entries
_IEFormElementSetValue ($oQuery, $Keyword)
$oQuery = _IEFormElementGetCollection ($oForm, 2)
_IEFormElementSetValue ($oQuery, $Keyword1)
$oQuery = _IEFormElementGetCollection ($oForm, 3)
_IEFormElementSetValue ($oQuery, $Keyword2)
$netinfo = _IEFormSubmit ($oForm, 1)     ;(?Test Line not able to get the result )
$nText = _IEBodyReadText ($netinfo)   ;(??????Test Line not able to read text)
MsgBox(0,'Text',$nText)
$sText = _IEBodyReadText ($oForm)  ;(??????Test Line not able to read text)
MsgBox(0,'msg', $sText )     ;(Test Line can not display text)
;Get the html code of the results page
$Url = $netinfo
; Google one line test code
; Local $Url = 'http://www.google.com/search?q='&$Keyword&'+%22'&$Keyword1&'%22+'&$Keyword2&'&hl=en&num=10&lr=&ft=i&cr=&safe=images'

Local $Html = BinaryToString(InetRead($Url))
;Get only the body code
$Html = StringMid($Html,StringInStr($Html,'<body'))
;Remove the javascripts
$Html = StringRegExpReplace($Html,'(?s)(?i)<script.+?script>','')
;Retrieve the visible text
Local $Text = StringRegExpReplace($Html,'(?s)<.+?>','')
;Display the visible text
MsgBox(0,'','Page text:'&@CRLF&$Text)
Edited by MaoMao

Share this post


Link to post
Share on other sites



Please help for collect data in web page.

So far able to enter info in web search engine use IE function.

Problem for how Atuoit perform web page info collecton.

How to read the web content TEXT after submit the form.

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