Since I'm feeling generous...
#Region _WebComposeURL()
; ===================================================================
; _WebComposeURL($sURL, $sLogin = "", $sPass = "", $sParams = "")
;
; Builds a valid URL from the four component parts.
; Parameters:
; $sURL - IN - The URL use.
; $sLogin - IN/OPTIONAL - The login to send with the URL.
; $sPass - IN/OPTIONAL - The password to send with the URL (Requires a login name).
; $sParams - IN/OPTIONAL - Optional parameters to send with the page.
; Returns:
; A valid URI-encoded URL.
; ===================================================================
Func _WebComposeURL($sURL, $sLogin = "", $sPass = "", $sParams = "")
Local Const $aURIValidChars[256] = _
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _
0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0, _
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, _
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0, _
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Local $sFullURL
Local $nPos = StringInStr($sURL, "://")
If Not $nPos Then
$sFullURL = "http://"
Else
$sFullURL = StringLeft($sURL, $nPos+2)
$sURL = StringTrimLeft($sURL, $nPos+2)
EndIf
If $sLogin And StringLeft($sURL, StringLen($sLogin)) <> $sLogin Then
$sFullURL &= $sLogin
If $sPass Then $sFullURL &= ":" & $sPass
$sFullURL &= "@"
EndIf
For $i = 1 To StringLen($sURL)
Local $c = StringMid($sURL, $i, 1)
If Number($aURIValidChars[Asc($c)]) Then
$sFullURL &= $c
Else
$sFullURL &= StringFormat("%%%02X", Asc($c))
EndIf
Next
If $sParams Then
$sFullURL &= "?"
For $i = 1 To StringLen($sParams)
Local $c = StringMid($sParams, $i, 1)
If $c = " " Then $c = "+"
If Number($aURIValidChars[Asc($c)]) Then
$sFullURL &= $c
Else
$sFullURL &= StringFormat("%%%02X", Asc($c))
EndIf
Next
EndIf
Return $sFullURL
EndFunc; _WebComposeURL()
#EndRegion _WebComposeURL()