Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
10/26/2008 12:55:17 PM EDT
I am trying to figure out a way to periodically (automated) have a script of some kind go out to an external URL, grab a .jsp file, save it as into a standard image format such as .bmp, .jpg, etc and then FTP the image to a server.



The .jsp file in question is the Chicago Traffic Map found here: http://www.gcmtravel.com/gcm/maps_chicago.jsp



I only want the map, not the entire page.



Any ideas????



Thanks in advance!!!
10/26/2008 8:04:01 PM EDT
[#1]
Making the request to get the HTML generated by the jsp won't be hard, the page is designed to use javascript to pull the images afterwards and that will be a pain.
               <td valign="center" align="center" bgcolor="#FFFFFF">



                   <script language="JavaScript">



                       document.write("<img name='mainmap' src='' border='0' alt='Chicago map' title='Click on the map for detailed information' width=575 height=575>");



                   </script>



                   <noscript>



                       <img name='mainmap' src='gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390' border='0'



                           alt='Chicago map' title='Detailed information not available with JavaScript disabled' width=575 height=575>



                   </noscript>



               </td>





Edit:





ok, my walking thru the java script, you can decipher the url to get the image, but you have to pass the paramerates of what map you want (and other options) and you will get back a gif images





example





http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&zoom=0.008&mmzoom=0.003&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES&mousex=287&mousey=287&mmulLat=4220470&mmulLng=-8813390



edit 2



or you can copy and paste like the bastard below me.....




 
10/26/2008 8:08:23 PM EDT
[#2]
I see the image url is:


http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390





http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390




If it were linux a cron job with wget and ncftp would do the trick.





-Foxxz





 
10/27/2008 5:39:48 AM EDT
[#4]
Thanks everybody.

What I am hoping to accomplish is to be able to go grab the .jsp file once every 5 mins or so as an automated task and save it into a standard image format such as a jpg for display to a different device (that only supports standard image formats).

10/27/2008 11:59:17 AM EDT
[#5]
it returns a .gif, using the URLs provided above. What more is there to do?

(Status-Line)HTTP/1.1 200 OK
ConnectionKeep-Alive
Content-Typeimage/gif
DateMon, 27 Oct 2008 19:58:03 GMT
ServerApache-Coyote/1.1
Transfer-Encodingchunked

10/27/2008 2:31:52 PM EDT
[#6]
Quoted:
it returns a .gif, using the URLs provided above. What more is there to do?

(Status-Line)HTTP/1.1 200 OK
ConnectionKeep-Alive
Content-Typeimage/gif
DateMon, 27 Oct 2008 19:58:03 GMT
ServerApache-Coyote/1.1
Transfer-Encodingchunked




I can't use all the arguments.....................................

I need something that ends in .gif, .jpg, .bmp, etc.

The URL is not in that format.

http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&zoom=0.008&mmzoom=0.003&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES&mousex=287&mousey=287&mmulLat=4220470&mmulLng=-8813390
10/27/2008 3:05:18 PM EDT
[#7]
those are not arguments, it is part of the response header. Save it to something and rename it .gif if you want; the datastream you get is a gif file. that it doesn't end in .gif is immaterial.


10/28/2008 12:22:18 PM EDT
[#8]


It'd be pretty easy in C#.  I could walk you through it if you have the .net SDK and the runtime installed.



C++, too, although that would be a little more difficult for you.



vb.net would be very similar to C#.



If you want to try vbscript, you could look at these two samples, which combine to give you the functionality you need:



http://www.paulsadowski.com/WSH/getremotebinaryfile.htm



http://www.tek-tips.com/viewthread.cfm?qid=1191903&page=1 (Look at the code in third post, it calls ftp.exe with a script as parameter)



Then just schedule your .vbs script to run every five minutes, or have a five minute timer in it, although I'm not sure vbscript has that functionality.

10/29/2008 1:50:49 PM EDT
[#9]
Quoted:
Thanks everybody.

What I am hoping to accomplish is to be able to go grab the .jsp file once every 5 mins or so as an automated task and save it into a standard image format such as a jpg for display to a different device (that only supports standard image formats).



What systems are you using? What are you uploading it to? Is this private use or commercial?

It's dead easy to do this with wget to pull the image, but pushing it to the other device may be a problem.

Or, if your other device has a web browser you could setup a website with a PHP page that pulls the image from their server and re-serves it to your device without all the associated tools.

10/30/2008 9:49:42 PM EDT
[#10]
Quoted:
I see the image url is:
http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390

http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390


http://www.gcmtravel.com/gcm/gwbroker?handler=map&type=image&width=575&height=575&layers=%2BROADS%2BLAKES%2BCOUNTIES%2BCONSTRUCTION%2BANNOTATIONS%2BCONGESTION%2BINCIDENTS%2BTRAVELTIMES%2BAIRPORTS%2BMESSAGES%2BCAMERAS&zoom=0.008&mmzoom=0.003&mousex=58&mousey=114&mmulLat=4220470&mmulLng=-8813390

If it were linux a cron job with wget and ncftp would do the trick.


-Foxxz

 


This - with a little bash script.