hi Vijay!
As I understand it, libcurl allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols.
The most basic definition of the curl library is this:
Curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. Curl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, http proxy tunneling and a busload of other
I have read it many times hoping to have a better understanding of what it does but I am not having much luck.
As for your next question about writing an output to a textfile, that is one of the functionalities.
I believe I did that with this code;
'check if file exists, if it dosn't, create it
If not fso.FileExists("temp:\ftemp") then
'it doesn't exist, lets create it
set vinputfile = fso.OpentextFile("temp:\ftemp",8,true) 'open for appending with the create option on
Else
'otherwise it exists, so just open it for appending
Set vinputfile = fso.CreateTextFile("temp:\ftemp",False,False)
All I am trying to do now is to take whatever is stored in the textfile and send it to the browser via the http:
I believe that is what they did here with php:
$inputfile = tempnam("temp/","ftemp");
# strip web server from $img
if ( substr($img,0,5) == 'http:' )
{
preg_match("/http:\/\/[^\/]+(\/.*)$/",$img,$match) ;
# $img = $match[1];
}
$win_array = split(" ",$win);
$w = $win_array[2] - $win_array[0];
$h = $win_array[3] - $win_array[1];
$mapsize_array = split(" ",$mapsize);
$mapext_array = split(" ",$mapext);
$vert_exag = 1.0;
#shading intensity factor
$factor = 15;
# reduced sampling factor for Elevations
$red_factor = 5.0;
#clipping bounds for elevations
$base_elev = 600;
$cap_elev = 2000;
$zspacing = ($factor * $red_factor);
$xspacing = ($factor * $red_factor);
#zoom speed realtes to workd_size
$world_size = 5;
$scale = $world_size/$mapsize_array[0];
$mapwidth = floor($mapsize_array[0]/$red_factor);
$mapheight = floor($mapsize_array[1]/$red_factor);
$ch = curl_init("http://www.gc/ms4.0/mapserv?map=/web/wms/ms/terrain/mapserv.map&mode=map&layers=dem&map_imagetype=AAIG rid&mapsize=$mapwidth+$mapheight&mapext=".str_repl ace(" ","+",$mapext));
$fp = fopen($inputfile,"w");
curl_setopt($ch,CURLOPT_FILE,$fp);
curl_setopt($ch,CURLOPT_HEADRER,0);
curl_setopt($ch,CURLOPT_VERBOSE,0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
$ascii = file($inputfile);
echo "#VRML V2.0 utf8\n\n";
$ncols = 0;
$nrows = 0;
and my translation up to that point is ok, I think:
'open our log file
Dim fso, vinputfile
Set fso = CreateObject("Scripting.FileSystemObject")
'check if file exists, if it dosn't, create it
If not fso.FileExists("temp:\ftemp") then
'it doesn't exist, lets create it
set vinputfile = fso.OpentextFile("temp:\ftemp",8,true) 'open for appending with the create option on
Else
'otherwise it exists, so just open it for appending
Set vinputfile = fso.CreateTextFile("temp:\ftemp",False,False)
End If
'close our file
vinputfile.close()
'remove the references to cleanup memory
Set vinputfile = Nothing
Set fso = Nothing
' strip web server from f_img
if left(f_img,5) == "http:" then
'First, create a reg exp object
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.pattern = "<a\s+href=""http://(.*?)"">\s*((\n¦.)+?)\s*</a>"
'Now, replace the HREF tags with our preferred format
strText = objRegExp.Replace(f_img,pmatch, "f2 [http://f1]")
win_array = split(fwin," ");
w = win_array(2) - win_array(0);
h = win_array(3) - win_array(1);
mapsize_array = split(mapsize," ");
mapext_array = split(mapext," ");
vert_exag = 1.0;
'shading intensity factor
vfactor = 15;
' reduced sampling factor for Elevations
vred_factor = 5.0;
'clipping bounds for elevations
vbase_elev = 600;
vcap_elev = 2000;
vzspacing = (vfactor * vred_factor);
vxspacing = (vfactor * vred_factor);
'zoom speed realtes to workd_size
vworld_size = 5;
vscale = vworld_size/vmapsize_array(0);
vmapwidth = math.floor(vmapsize_array(0)/vred_factor);
vmapheight = math.floor(vmapsize_array(1)/vred_factor);
vch = curl_init("http://fwms.gis.fc/ms4.0/mapserv?map=/web/wms/ms/terrain/mapserv.map&mode=map&layers=dem&map_imagetype=AAIG rid&mapsize=vmapwidth+vmapheight&mapext=".str_repl ace(" ","+",vmapext));
vfp = fopen(vinputfile,"w");
curl_setopt(vch,CURLOPT_FILE,vfp);
curl_setopt(vch,CURLOPT_HEADRER,0);
curl_setopt(vch,CURLOPT_VERBOSE,0);
curl_exec(vch);
curl_close(vch);
fclose(vfp);
vascii = file(vinputfile);
Response.write("'VRML V2.0 utf8\n\n")
vncols = 0;
vnrows = 0;
Please forgive me for the dump, I am just trying to find a way to make sense.
|