Page 1 of 1

recieve image over HTTP ??? Help

Posted: Sun Jul 17, 2005 12:06 pm
by bender-rulez
Hi,
I would need to recieve an image over http to display in pb!

how could that be done?

Thanks

Posted: Sun Jul 17, 2005 12:30 pm
by fweil
bender-rulez,

Does your question mean getting an image from an URL ?

In this case the easiest way should be to create a window with a web gadget.

If not maybe you could give more details.

Rgrds

Posted: Sun Jul 17, 2005 12:46 pm
by Dare2
Some good code for this sort of thing can be found in the code archive on www.purearea.net

Posted: Sun Jul 17, 2005 1:00 pm
by bender-rulez
Ok,

what i found already here in the forum is this for getting the image via http

Code: Select all

; Standard Connection Types
#CONNECT_FTP=21
#CONNECT_HTTP=80
#CONNECT_HTTPS=81

Connection.l = OpenConnection("www.example.com",#CONNECT_HTTP) ;OpenConnection
   RecieveNetworkFile( Connection, "download/examples/example.jpg" )
CloseConnection( Connection ) ; close connection 
the image will then recieved?!
what now?

how to display the image or save it to disk?
sorry about that question, but loading an image from disk I know how it works, but getting over the network?!?

I need it for without WinAPI

Thanks

Posted: Sun Jul 17, 2005 1:16 pm
by bender-rulez
Sorry Dudes! I got it already! :-)

Corrected Code

Code: Select all

; Standard Connection Types
#CONNECT_FTP=21
#CONNECT_HTTP=80
#CONNECT_HTTPS=81

Connection.l = OpenNetworkConnection("www.example.com",#CONNECT_HTTP) ;OpenConnection
   ReceiveNetworkFile( Connection, "download/examples/example.jpg" )
CloseNetworkConnection( Connection ) ; close connection 
this do the magic! its download the File to the directory where my programm startet from!

Thanks at all!

Posted: Sun Jul 17, 2005 3:39 pm
by bender-rulez
damed, my mistake, does not work at all!

Any clues?!

Posted: Sun Jul 17, 2005 5:58 pm
by fweil
I guess the problem is that you do not deal well with HTPP / FTP protocols right now ...

When opening an HTTP connection you first have to negociate with the server. Same for an FTP one.

Posted: Wed Jul 20, 2005 12:07 am
by kenmo
Will DownloadURLToFile not work in this case?

Posted: Wed Jul 20, 2005 10:45 am
by bender-rulez
I solved it already, I will post the code when at home again!

@kenmo: downloadURLtoFile is winAPI, but I do develop for Linux and Windows

thanks at all