Click to See Complete Forum and Search --> : Any way to recieve data back from CGI script in active HTML page?


riverrat
08-25-2003, 03:23 PM
I have a user that needs to get a price from another server that has software which performs the price calculations. That server doesn't have access to the page or other resources. I need to call it to just perform the calculation and somehow send it back to be placed on the active page. I've been pulling my hair out trying to come up with something but to no avail. Is this possible? I figured I could call it with something like "document.location = 'http://www.site.com/cgi-bin/script.cgi?name=zoid;sku=1234;qty=4';" but receiving is a different animal. My only other option is to somehow update a database that they have access to. Thanks!

simpson97
08-26-2003, 03:41 AM
have you looked into PHP using cURL

here is a piece of curl imbedded in php
it establishes a socket connection with remote server
<?
// initiate connection and set parameters

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.remoteserver.html");
curl_setopt($ch, CURLOPT_USERAGENT, "X-Cart");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $yourformdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// connect to remote server & get response string
// if OK transaction will be processed
$return_string = curl_exec($ch);
?>
with all vars inited it connects to remote server & waits for response