Yeah, but it's in PHP.

Here's a function that retrieves a file from a remote server. It can
post data, also, just like with cfhttp.

Add the following parameters to the headers section in order to get past
authorization. I included a description of the headers for your
reference.

--------------------------------------------
Headers:

AUTH_PASSWORD

The password entered into the authentication box. Only used if BASIC
authentication is used otherwise it is blank so it does not show the NT
password. However, if BASIC is the form of auth used then the NT
password is shown.


AUTH_TYPE

The mode of authentication that the server used to grant or deny the
user permissions. BASIC, NTLM, DIGEST are the possible types.


AUTH_USER

The username that has been authenticated. If BASIC then "username" is
all one would see but if NTLM then "DOMAIN\username" is the format.

------------------------------------------
Function:

function
get_packet_off_server($remote_server,$port,$script,$vars,$headers = 0){
/* get_packet_off_server($remote_server,$port,$script,$login=>0)
------------------
Arguments:
------------------
$remote_server - server to connect to
$port - port to connect to
$script - path to particular file to hit
$vars - variables to POST to the server
must be provided in the form of an associative array
$headers - headers to post with the connection
default set in the method, or you can roll your own
------------------
Returns:
------------------
File Content
------------------
Note:
------------------
Do not indent the headers!
*/
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";
$urlvars = "";
while (list($key,$value) = each($vars))
$urlvars.= urlencode($key) . "=" . urlencode($value) .
"&";
$urlvars = substr($urlvars,0,-1);
$content_length = strlen($urlvars);
if($headers == 0){
$headers = "POST $script HTTP/1.1
Accept: */*
Accept-Language: en-au
Content-Type: application/x-www-form-urlencoded
User-Agent: $user_agent
Host: $remote_server
Connection: Keep-Alive
Cache-Control: no-cache
Content-Length: $content_length

";
}
$this_socket = fsockopen($remote_server, $port, $errno,
$errstr);
if (!$this_socket) {
    echo "$errstr - ($errno)<br>\n";
return false;
} else {
socket_set_timeout($this_socket, 20);
fputs($this_socket, $headers);
fputs($this_socket, $urlvars);
$ret = "";
while (!feof($this_socket))
$ret.= fgets($this_socket, 1024);
fclose($this_socket);
return $ret;
}
}

-----Original Message-----
From: Todd [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 8:16 PM
To: CF-Community
Subject: Off Topic - Alternative to CFHTTP

I need to get info off of a site that is protected with NT
Challenge/Response.  Does anyone know of an alternative to CFHTTP that
with
work with that type of authentication?

Todd
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to