How to fetch image from URL (HTTP) in c++? [closed]
How can I fetch an image from a URL in c++ and store it on harddisk? Thanks.
I am working in the openGL environment in c++ so that code is not related to my question. All i want to do is fetch some image from a URL and store it on my hard disk.
Which is the Google Map static map API which i want to use to fetch the image and store.
Sample request URL would be: http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap &markers=color:blue%7Clabel:S%7C40.702147,-74.0开发者_开发百科15794&markers=color:green%7Clabel:G%7C40.711614,-74.012318 &markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
C++ isn't PHP and has no means to do that itself. You'll have to use the platform API at least (to open a socket, which isn't a part of the C++ standard), and better yet, use a third-party library — for example, with Qt you could do that in a few lines.
You could use a library such as libcURL.
精彩评论