soballe
asked on
URL fails with IdHttp.get, works fine in browser
The following URL works fine when pasted into a Browser:
http://tigerweb.geo.census.gov/ArcGIS/services/tigerWMS/MapServer/WMSServer?&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Linear%20Hydrography&STYLES=&SRS=EPSG:4326&BBox=-91.64,43.30,-91.36,43.53&WIDTH=542&HEIGHT=671&FORMAT=image/jpeg
But you get "invalid request" from the server when you use this URL in idhttp.get(URL,stream);
Any ideas - I think it may be something in the http header that indy is sending?
http://tigerweb.geo.census.gov/ArcGIS/services/tigerWMS/MapServer/WMSServer?&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Linear%20Hydrography&STYLES=&SRS=EPSG:4326&BBox=-91.64,43.30,-91.36,43.53&WIDTH=542&HEIGHT=671&FORMAT=image/jpeg
But you get "invalid request" from the server when you use this URL in idhttp.get(URL,stream);
Any ideas - I think it may be something in the http header that indy is sending?
ASKER
Thanks, that's apparently the default, and that's what I've been using - sadly, it doesn't work. Is there another option for the UserAgent?
Added background:
I've left everything in the IdHttp at default settings.
the Actual response I get is "HTTP/1.1 400 Bad Request"
Added background:
I've left everything in the IdHttp at default settings.
the Actual response I get is "HTTP/1.1 400 Bad Request"
From Delphi 7 up to Delphi 2010 the default value for that property is "Mozilla/3.0 (compatible; Indy Library)" and this raises a bad request error: setting the value to simply "Mozilla/3.0" solved my problems. Be sure nothing is after "Mozilla/3.0".
If this doesn't helòp you, unfortunately I can't figure out any other solution...
Cheers
If this doesn't helòp you, unfortunately I can't figure out any other solution...
Cheers
ASKER
Thanks marqusG, but that didn't do it.
I'm very sorry, soballe. Good luck.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The WinINET approach with Delphi is well documented and there are plenty of examples posted on line that actually work - no more time right now to mess around with Indy's HTTP component.
Cheers