Reputation: 23
I'm trying to use the Malware and Productivity URL Lookup API to perform a lookup for a URI. The documentation suggests the form should be:
[ scheme ":" "//" ] [ userinfo "@" ] host [ ":" port ] path-abempty [ "?" query ] [ "#" fragment ]
yet I'm getting the following results:
- lookup https://www.frilfordheath.co.uk/ -> Not Found
- lookup https://www.frilfordheath.co.uk -> Not Found
- lookup www.frilfordheath.co.uk/ -> Not Found
- lookup www.frilfordheath.co.uk -> Found
Code is JavaScript, and the URI are passed in as
encodeURI(linktocheck)
, but I'm getting the same results without encodeURI.
How should the URI be specified?
Upvotes: 2
Views: 71
Reputation: 26
Try using
encodeURIComponent(linktocheck)
instead.
From the docs, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
encodeURI escapes all characters except:
Not Escaped:
A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
whereas encodeURIComponent escapes all characters except:
Not Escaped:
A-Z a-z 0-9 - _ . ! ~ * ' ( )
Upvotes: 1