|
|
|
This function will post data to the HTTP server, using the user:pass base64(basic)
authentication algorithm.
It can also post browser agent, so web server would think it's a normal user (enter smth
like "Mozilla/4.0 (Macintosh; I; PPC)" in the agent.
Works great for parsing protected content.
To use reply from the server, utilize $reply variable.
example to run the function :
<?
HTTPpost("www.site.com","/cgi-bin/test.pl","data=hello","johny","walker","Mozilla/4.0
(compatible; MSIE 5.5; Windows NT 5.0)");
?>
function HTTPost($host, $path, $data_to_send,$user,$pass,$agent) {
$fp = fsockopen($host,80, &$err_num, &$err_msg, 10);
if (!$fp) {
echo "$err_msg ($err_num)<br>\n";
} else {
$auth = $user.":".$pass ;
$string=base64_encode($auth);
echo $string;
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Authorization: Basic ".$string."\r\n");
fputs($fp, "User-Agent: ".$agent."\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
for ($i = 1; $i < 10; $i++){$reply = fgets($fp, 256);}
fclose($fp);
}} |
|
| Simple Password example Categories : PHP, Authentication, Security, HTTP | | | HTTP Basic Authentication via POP3. Categories : Authentication, HTTP, Email, PHP | | | redirect redirection ip address authentication authenticate addr Categories : Authentication, HTTP, Network, PHP | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | Basic Authentication with sessions Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions | | | PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character. Categories : PHP, Algorithms, Security, Authentication, Encryption | | | Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database. Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication | | | Function to remember password Categories : PHP, Authentication, Personalization and Membership | | | PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL | | | Is there some possibility to link a database to an htaccess file, so that instead of having a passwd file you would have a database with DES-crypted password and username fields? Categories : Authentication, PHP, General SQL, Databases | | | Authorize Me! An authentication script. Categories : MySQL, Databases, Authentication, PHP | | | WebServerSpy checks which kind of Webserver is running, Apache, Netscape, Fasttrack, IIS, HTTP-Header, HTTP 1.0, GET, spy, WWW Categories : HTTP, Network, Apache, PHP, Web Servers | | | Authentication script to authenticate users in Active Directory through LDAP. Categories : LDAP, Authentication, Cookies, PHP | | | MD5 secured login Categories : PHP, Java Script, Authentication, Security | | | Import the yahoo address book. Categories : PHP, CURL, Authentication | |
|
|
|