Woops, you're right. It doesnt return anything on failed attempt.
Would this be OK?
If successfull, it'll return domain name
If not successfull, but the input URL is valid, then it'll return the original URL (which might be a domain name already)
If not successfull, and the input is not URL at all, then it will output "No Valid Domain Found"
FUNCTION GetDomainName(webPage$)
//GET DOMAIN NAME. Put in clean URL in webPage$
currentDomain$ = ""
webPage$ = webPage$
Start = instr(webPage$, "http")
IF Start > 0
INC Start,8
Finish = FIND ASCII( webPage$, 47, Start)
IF Finish > 0 THEN domainResult$ = mid$( webPage$, 1, Finish-1 )
IF Finish = 0 THEN domainResult$ = webPage$
ENDIF
IF Start = 0
domainResult$ = "No Valid Domain Found"
ENDIF
ENDFUNCTION domainResult$
Regarding the
inc 8 thing,
I made the function with the assumption that we already know what webpage we're in, so we can input the address in the function to get domain name. For example, we can input this
https://forum.thegamecreators.com/thread/218443
and get this
https://forum.thegamecreators.com
The inc 8 is just there so it skips the whole https:// or http:// thing, and search for the next / that marks the end of domain name. So it should work with both https:// or http://
Another thing though. I'm not good with HTML terminologies.
You mention that you used googleURL=http://www.secureserverspace.com/pagename.php?value=5 as input string
The function would not work if we include that googleURL= bit at the start. I didn't make the fucntion search for Start position, because we assume all links fed to the fucntion starts with htt
My question is, is googleURL=http://www.secureserverspace.com/pagename.php?value=5 what people usually call 'complete' URL?
https://forum.thegamecreators.com is domain name.
Then what about https://forum.thegamecreators.com/thread/218443 . What do we call that kind of URL?
Or is it googleURL=http://www.secureserverspace.com/pagename.php?value=5 is what people usually call and URL?