Correct way to httprequest images?

I recently have taken to httprequest .pngs.
The httprequesting part is fine and dandy but when I write the image into a .png and try to open it it complains about being unable to open it. I tried opening the file in notepad and it seems to be correct-ish (starts with “‰PNG” and has a bunch of gibberish)

Although from looking at it it does miss a few "gibberish blocks"
So I’ve pastebin’d the working .png I downloaded and the one wrote to file by urho3d:

If it helps, this is how I get the .png data

request = network->MakeHttpRequest("");
bool mtlDone = false;

ur::String mtl;
while (!mtlDone) {
if (request->GetState() == ur::HTTP_INITIALIZING) continue;
else if (request->GetState() == ur::HTTP_ERROR) objDone = true;
else {
while (request->GetAvailableSize() > 0) {
mtl += request->ReadString();
if (request->GetState() == ur::HTTP_CLOSED) {
mtlDone = true;

(In other questions, is there a way to set a material’s texture using just a raw image instead of making a file manually and writing all .png data in it?)


Here is some posted code for reading response data. Maybe it will help?

For the last question, the answer is ‘yes’. Victor may have posted a working example here

but there are some others posted.

Hope that is some help. Let us know how it’s coming along :slight_smile:

The way he did does not seem to be working.
I’m going to be trying curlpp and see if that brings any results.
Thanks though! :slight_smile: