I don't really need to provide a script for this, but here's an example:
url = "url.com" http = game.HttpService if not http:GetAsync(url) then print("invalid!") else print("valid!")
you get the point. My problem is that whatever way i try and do this, it always returns a http not found (404) even if i'm using 'if not'. Would there be any way to detect an invalid url?
thanks!
After messaging Seranok, he told me:
There is currently no way to check the status code of the response. At some point in the future we may add this functionality but not in the foreseeable future. If you want to handle errors you can use pcall.
To use pcall, do this:
function getData() --request here return --return the response end success, responseBody = pcall(getData) if success then --do something with responseBody else print("There was an error") end
From what I'm getting out of what you're asking, the easiest way it seems to do this, would be to search for 404 on the page, and if it's there, then it prints "Invalid!" Hope this helped. If not feel free to keep asking me for help until we solve your problem so it does work.