WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Authentication HTTP protocol POST
Categories : Authentication, HTTP, PHP Update Picture
Alexei Pashkovsky
Date : Nov 21st 2000
Grade : 2 of 5 (graded 7 times)
Viewed : 15667
File : HTTPost.php3
Images : No Images for this code example.
Search : More code by Alexei Pashkovsky
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

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