Xbase++
Xbase++
Parse a URL into its Component Parts
See more HTTP Examples
Demonstrates how to parse a URL into it's component parts.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oUrl
LOCAL cUrlStr
nSuccess := 0
oUrl := CreateObject("Chilkat.Url")
cUrlStr := "https://www.amazon.com/Anarchy-State-Utopia-Robert-Nozick/dp/0465051006/ref=sr_1_1?s=books&ie=UTF8&qid=1430344305&sr=1-1&keywords=nozick#frag123"
nSuccess := oUrl:ParseUrl(cUrlStr)
// Assume success..
? "URL: " + cUrlStr
? "Host: " + oUrl:Host
? "Port: " + Str(oUrl:Port)
? "HostType: " + oUrl:HostType
? "Ssl: " + Str(oUrl:Ssl)
? "Path: " + oUrl:Path
? "Query: " + oUrl:Query
? "Frag: " + oUrl:Frag
? "----"
cUrlStr := "http://matt:secret@www.chilkatsoft.com:8080/somepath.asp?test=123&size=2"
nSuccess := oUrl:ParseUrl(cUrlStr)
// Assume success..
? "URL: " + cUrlStr
? "Host: " + oUrl:Host
? "Port: " + Str(oUrl:Port)
? "HostType: " + oUrl:HostType
? "Ssl: " + Str(oUrl:Ssl)
? "Login: " + oUrl:Login
? "Password: " + oUrl:Password
? "Path: " + oUrl:Path
? "Query: " + oUrl:Query
? "Frag: " + oUrl:Frag
oUrl:destroy()