Request JSON Data from HTTPS with C++? -


i'm writing program in c++ needs download json data https url. program based on wxwidgets. url translation service @ glosbe

so i've tried multiple different libraries including:

  • libcurl
  • boost.asio
  • the http functionality included in wxwidgets
  • wxcurl
  • urdl

however, throws error saying can't connect, or reply says "moved permanently".

when copy , paste url testing browser, returns json data perfectly.

does know correct way this?

any great!

301 moved permanently server responds when try access page http instead of https. here's complete response received server:

http/1.1 301 moved permanently server: nginx date: thu, 16 jul 2015 20:25:01 gmt content-type: text/html content-length: 178 connection: keep-alive location: https://en.glosbe.com/a-api 

it means that: "the content looking @ https://en.glosbe.com/a-api." browser adheres http protocol following server's hint , automatically proceeding request https://en.glosbe.com/a-api when try access http://en.glosbe.com/a-api. works seamlessly user.

you have read more documentation create https requests yourself. each of libraries mentioned have different way of supporting https (or not support @ all). example, have @ http://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/overview/ssl.html, "notes" section says "openssl required make use of boost.asio's ssl support."


Comments