How to read https webpage..
BlitzMax Forums/BlitzMax Programming/How to read https webpage..
| ||
Hi, i have this example, Is it possible to do the same thing with https ?? |
| ||
HTTPS works via the SSL/TLS protocol, and requires you to handle all of the security features that those provide - in order to get access to the pages. A library such as libcurl built with OpenSSL support can do this for you. Otherwise, you may want to look into interfacing with some SSL libraries and handling all the SSL certification functions yourself. With libcurl you might do it like this: Framework BaH.libcurlssl Import BRL.StandardIO Import BRL.FileSystem Local curl:TCurlEasy = TCurlEasy.Create() curl.setWriteString() curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1) curl.setOptString(CURLOPT_URL, "https://some.web.page.com") Local res:Int = curl.perform() If res Then Print CurlError(res) End End If curl.cleanup() Print curl.toString() |
| ||
Thanks for reply, i'll try |
| ||
Hi Brucey, that looks nice and simple, but do you know how the certificate stuff works? For any site I've tried (eg. "https://www.google.co.uk/"), the above code returns:"Peer certificate cannot be authenticated with given CA certificates". I tried replacing libcurlssl.mod/certificates/cacert.pem with this one, and even rebuilt the module just in case, but it still gives the same result. (Interestingly, the linked cacert.pem is smaller, despite being automatically kept up to date. Not sure if that's to do with the Diginotar stuff being removed or what... ) |