I have this very tiny php script which does exactly what I need – I need to convert it to classic ASP however. I have googled but been unable to find information on anything similar to ‘fopen’ or ‘fwrite’ in classic ASP.
My original PHP Script is:
<?php $responseImg = file_get_contents("http://url.to/the/api/thatreturnsagif"); $fp = fopen("/my/server/public_html/mydirectory/samepicture.gif", "w"); fwrite($fp, $responseImg); fclose($fp); ?>
Really short, really simple and does just what I need. It makes a call to an API that returns a gif. I save the gif on my local server and a cron-job runs the script every so often to keep the gif up to date.
I’m moving to an IIS server which does not have php on it, so classic ASP will have to suffice.
I’ve gotten this far:
<% url = "http://url.to/the/api/thatreturnsagif" set xmlhttp = server.CreateObject("Msxml2.ServerXMLHTTP.6.0") xmlhttp.open "GET", url, false xmlhttp.send "" Response.write xmlhttp.responseText set xmlhttp = nothing %>
I was able to put that together from some other stuff online.
I just need to figure out how to save the gif that will be returned on the server – then I will setup scheduled tasks to run it on an interval.
Any help appreciated.