julia> usinh HTTP
ERROR: syntax: extra token "HTTP" after end of expression
julia> using HTTP
julia> url="https://www.similarweb.com/website/pb.pl"
"https://www.similarweb.com/website/pb.pl"
julia> r=HTTP.get(url);
ERROR: HTTP.ExceptionRequest.StatusError(405, "GET", "/website/pb.pl", HTTP.Messages.Response:
"""
HTTP/1.1 405 Method Not Allowed
Server: nginx
Date: Thu, 12 Mar 2020 18:54:21 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Accept-Ranges: bytes
X-DB: 0
X-DW: 32
X-DZ: 127.0.0.1
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Cache-Control: private, no-cache, no-store, must-revalidate
Edge-Control: no-store, bypass-cache
Surrogate-Control: no-store, bypass-cache
It’s the server, they are rejecting your request, probably because it looks like a robot accessing the page. If you do:
HTTP.get(url;headers=Dict("User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"))
The page fetches correctly. HOWEVER the site appears to be a JavaScript application, not standard HTML. My guess most of the site is embedded in the /smlrdstl.js script…
1 Like
Thanks, it works, but script…
Is any cure for this
julia> url="https://www.styl.pl"
"https://www.styl.pl"
julia> HTTP.get(url;headers=Dict("User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (
KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"))
ERROR: IOError(MbedTLS error code -9984: X509 - Certificate verification failed, e.g. CRL, CA or signature check
failed during request(https://www.styl.pl))
Paul
Two options, either you install their certificate, ugh. Or you configure HTTP to not verify the certificate. I would try this: