note 22666 modified in function.fsockopen by danbrown

From: Date: Sun, 20 Jul 2008 20:03:33 +0000
Subject: note 22666 modified in function.fsockopen by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142333@lists.php.net to get a copy of this message
You can post to a script that uses basic authentication if you create the header like this and insert it into the relevant script above; <?php // Build the header $header = "POST /path/to/script.cgi HTTP/1.0\r\nAuthorization: Basic "; $header .= base64_encode("$username:$password") . "\r\n"; $header .= "Content-type: application/x-www-form-urlencoded\r\n"; $header .= "Content-length: " . strlen($request) . "\r\n"; $header .= "Connection: close\r\n\r\n"; ?> --was-- You can post to a script that uses basic authentication if you create the header like this and insert it into the relevant script above; // Build the header $header = "POST /path/to/script.cgi HTTP/1.0\r\nAuthorization: Basic "; $header .= base64_encode("$username:$password") . "\r\n"; $header .= "Content-type: application/x-www-form-urlencoded\r\n"; $header .= "Content-length: " . strlen($request) . "\r\n"; $header .= "Connection: close\r\n\r\n"; http://php.net/manual/en/function.fsockopen.php

« previous php.notes (#142333) next »