youtuber Posted May 18, 2016 Share Posted May 18, 2016 (edited) I want to get the expiration date Local $sStr = InetRead("http://who.is/whois/autoitscript.com",0) If @error Then MsgBox(16,"Error!","Unable to retrieve information") Else $sStr = BinaryToString($sStr, 0) EndIf Local $info Local $expiration_date = StringRegExp($sStr, 'visibility: visible;">','</span></p>', 3) If UBound($expiration_date) = 3 Then $info = "Received data: " & $expiration_date[0] & @CRLF EndIf MsgBox(64,"Test",$info) Edited May 20, 2016 by youtuber Link to comment Share on other sites More sharing options...
Synapsee Posted May 18, 2016 Share Posted May 18, 2016 https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm StringRegExp.htm Sample 1 : $aArray = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '(?i)<test>(.*?)</test>', $STR_REGEXPARRAYMATCH, $iOffset) I use that on your script this give : Local $expiration_date = StringRegExp($sStr, '(?i)visibility: visible;">(.*?)</span></p>', 3) Result : 5 May 2017 youtuber 1 Link to comment Share on other sites More sharing options...
youtuber Posted May 18, 2016 Author Share Posted May 18, 2016 How could this be? Local $sStr = InetRead("https://www.autoitscript.com/forum/forum/2-autoit-general-help-and-support/",0) If @error Then MsgBox(16,"Error!","Unable to retrieve information") Else $sStr = BinaryToString($sStr, 0) EndIf Local $info Local $expiration_date = StringRegExp($sStr, '(?i)<span itemprop="name headline">(.*?)</span>', 3) If UBound($expiration_date) = 3 Then $info = "Received data: " & $expiration_date[0] & @CRLF EndIf MsgBox(64,"Test",$info) Link to comment Share on other sites More sharing options...
Synapsee Posted May 18, 2016 Share Posted May 18, 2016 maybe considerer _StringBetween() : #include <Array.au3> #include <String.au3> Local $expiration_date = _StringBetween($sStr, '<span itemprop="name headline">','</span>') _ArrayDisplay($expiration_date) youtuber 1 Link to comment Share on other sites More sharing options...
youtuber Posted May 18, 2016 Author Share Posted May 18, 2016 @Synapsee Thank you for answer Is this code right? #include <Array.au3> #include <String.au3> Local $sStr = InetRead("https://www.autoitscript.com/forum/forum/2-autoit-general-help-and-support/",0) If @error Then MsgBox(16,"Error!","Unable to retrieve information") Else $sStr = BinaryToString($sStr, 0) EndIf Local $expiration_date = _StringBetween($sStr, '<span itemprop="name headline">','</span>') _ArrayDisplay($expiration_date) Link to comment Share on other sites More sharing options...
Synapsee Posted May 18, 2016 Share Posted May 18, 2016 yeah it's correct, the array is feed... minor improve : use _StringBetween error #include <Array.au3> #include <String.au3> Local $sStr = InetRead("https://www.autoitscript.com/forum/forum/2-autoit-general-help-and-support/",0) If @error Then MsgBox(16,"Error!","Unable to retrieve information") Else $sStr = BinaryToString($sStr, 0) EndIf Local $expiration_date = _StringBetween($sStr, '<span itemprop="name headline">','</span>') If @error Then MsgBox(16,"Error!","_StringBetween : No strings found") Else _ArrayDisplay($expiration_date) EndIf Link to comment Share on other sites More sharing options...
youtuber Posted May 20, 2016 Author Share Posted May 20, 2016 I must do what the figures do not fully solve? What should be done to get the number 559 http://youtubertr.com/StringRegExp.html Local $expiration_date = StringRegExp($sStr, '(?i)stop-rank">(.*?)</span></font>', 3) Link to comment Share on other sites More sharing options...
Synapsee Posted May 20, 2016 Share Posted May 20, 2016 (edited) #include <Array.au3> #include <String.au3> Local $sStr = InetRead("http://youtubertr.com/StringRegExp.html",0) If @error Then MsgBox(16,"Error!","Unable to retrieve information") Else $sStr = BinaryToString($sStr, 0) EndIf Local $expiration_date = StringRegExp($sStr, '(?i)stop-rank">(.*?)</span></font>', 3) If @error Then MsgBox(16,"Error!","StringRegExp error") Else _ArrayDisplay($expiration_date) Msgbox(0, "Target", $expiration_date[0]) ;$expiration_date[0] ;Array is $expiration_date ;[0] is for array line number EndIf Edit : i warning you about $INET_LOCALCACHE / $INET_FORCERELOAD : Quote InetRead ( "URL" [, options = 0] ) options : $INET_LOCALCACHE (0) = Get the file from local cache if available (default). $INET_FORCERELOAD (1) = Forces a reload from the remote site. Edited May 20, 2016 by Synapsee youtuber 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now