Here is something I wrote you can use following leinad's suggestion. However, I don't have the time to handle escape sequences from the URL (replacing %20 with a space, etc.). If you have a list of those I could add it in, though.
Paste this into a new VB project and run it. Then you can just copy the S_GET function into your program and use it.Code:Option Explicit Private Sub Form_Load() Dim strURL As String, colParams As Collection strURL = "http://www.test.com/file.php?id=1¶m1=Hello!¶m2=hi&uid=1234&hello=7755" Set colParams = S_GET(strURL) MsgBox colParams("uid"), , "uid" MsgBox colParams("param1"), , "param1" Set colParams = Nothing End Sub Private Function S_GET(ByRef URL As String) As Collection Dim colRet As Collection, lonPos As Long Dim strParams() As String, l As Long Dim strValue() As String Set colRet = New Collection lonPos = InStr(1, URL, "?") If lonPos > 0 Then strParams = Split(URL, "&") For l = 0 To UBound(strParams) If InStr(1, strParams(l), "=") > 0 Then strValue = Split(strParams(l), "=") colRet.Add strValue(1), strValue(0) End If Next l End If Set S_GET = colRet Set colRet = Nothing Erase strParams, strValue End Function




Reply With Quote