KillingEye Posted March 14, 2009 Posted March 14, 2009 Hi, $String = '<a href="dorf1.php?a=2&c=4dc">' $nString = Stringsplit($String, '=', 2) MsgBox(0, "", $nString[3]) The Msgbox will output 4dc"> but i want only 4dc how can i do this? and my next question is: How can i read a string out of a website? A string like this <a href="dorf1.php?a=2&c=4dc">
Robjong Posted March 14, 2009 Posted March 14, 2009 (edited) Hey, hope this helps. You can do it using INetGet and String* functions $sURL = "http://www.autoitscript.com" InetGet($sURL, "source.html") $String = FileRead("source.html") $aMatch = StringRegExp($String, "<a.+?href=[\x22\x27](.*?)[\x22\x27].*?", 3) ; to get the URL's If Not IsArray($aMatch) Then Exit 1 For $i = 0 To UBound($aMatch) - 1 ;~ ConsoleWrite("A HREF [" & $i & "] " & $aMatch[$i] & @CRLF) If StringInStr($aMatch[$i], "=") Then ; check if there is a = char we can split on $nString = StringSplit($aMatch[$i], '=') ; split the url, $nString[0] will contain the number of elements which we can use to get the last one ConsoleWrite("Part: " & $nString[$nString[0]] & @CRLF) ; get the last query string element EndIf NextoÝ÷ Úî²)à¶û§rبƮ¶sb6æ6ÇVFRfÇC´RæS2fwC° ¢b33c¶ôRÒôT7&VFRgV÷C¶GG¢ò÷wwræWFöG67&Bæ6öÒgV÷C²Â¢b33c¶ôÆæ·2ÒôTÆæ´vWD6öÆÆV7Föâb33c¶ôR¤f÷"b33c¶ôÆæ²âb33c¶ôÆæ·0£·â6öç6öÆUw&FRgV÷C´$Tb²gV÷C²fײb33c¶fײgV÷CµÒgV÷C²fײb33c¶ÖF6²b33c¶Òfײ5$Äb b7G&ætå7G"b33c¶ôÆæ²æ&VbÂgV÷C³ÒgV÷C²FVâ²6V6²bFW&R2Ò6"vR6â7ÆBöà b33c¶å7G&ærÒ7G&æu7ÆBb33c¶ôÆæ²æ&VbÂb33³Òb33²²7ÆBFRW&ÂÂb33c¶å7G&æu³ÒvÆÂ6öçFâFRçVÖ&W"öbVÆVÖVçG2v6vR6âW6RFòvWBFRÆ7BöæP 6öç6öÆUw&FRgV÷Cµ'C¢gV÷C²fײb33c¶å7G&æu²b33c¶å7G&æu³ÕÒfײ5$Äb²vWBFRÆ7BVW'7G&ærVÆVÖVç@ VæD`¤æW Edit: added IE example Edited March 14, 2009 by Robjong
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