GLBasic forum

Main forum => GLBasic - en => Topic started by: acristo on 2008-Jul-17

Title: http request and netwebget
Post by: acristo on 2008-Jul-17
Hello there,

I'm trying to use the netwebget cmd to retrieve some data from a server, actually it is a game server that provide read only data through http request.

problem look like is a HTTP/1.0 at the end of cmd submited by netwebget as you can see the msg bellow...

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Invalid URI in request GET servlet/API?game=1&amp;player=xxxx&amp;apikey=c99d9aaf1999e7bf43 HTTP/1.0<P>
</BODY></HTML>

is netwebget suitable for this as well ? or do i need to find another way to do these http requests...

Thanks
Alessandro


Title: Re: http request and netwebget
Post by: Kitty Hello on 2008-Jul-17
You get what you see in your web browser. If that's of any use for you.
Title: Re: http request and netwebget
Post by: acristo on 2008-Jul-18
well, just found what is going on...
when using
NETWEBGET("200.51.41.29","http://www.server.com/servlet/HAPI?game=Gane5&player=Admin&hapikey=a0f3e761647e4d01f3", 8080, "str$.ini")
where the proxy is a free proxy on the net... it return the correct data, but if using
NETWEBGET("www.server.com","/servlet/HAPI?game=Gane5&player=Admin&hapikey=a0f3e761647e4d01f3", 80, "str$.ini")
without a proxy server it converted "&" Ampersand to &amp; which is invalid to the server i'm accessing returning no data... weird !!!

Can anyone help me answering why ?
Title: Re: http request and netwebget
Post by: Synthetic on 2008-Jul-18
I'm just guessing here as I didn't even know this command existed but try it without the forward slash for the beginning of the location:
Code (glbasic) Select
NETWEBGET("www.server.com","servlet/HAPI?game=Gane5&player=Admin&hapikey=a0f3e761647e4d01f3", 80, "str$.ini")
The tutorial for netwebget doesn't show the use of a forward slash as the function may automatically add it so it's worth a shot.

&amp; is the HTML representation for &.