HTTP Class

From: Date: Mon, 01 Jan 2001 02:09:05 +0000
Subject: HTTP Class
Groups: php.pear 
Request: Send a blank email to php-pear+get-760@lists.php.net to get a copy of this message
I have a HTTP class that is supposed to be used to communicate with webservers using the http protocol, in short retrieve pages with style, the class will privide a way to fetch web content and the features are in general : 1) can take a key-arrays ( $get, $post, and $cookies ) and construct proper headers to send the information. 2) can connect using Basic authentication. 3) can specify other variables like accept types, user agent, etc .. and after fetching the content the class will provide : 1) full header and contents returned. then parse the headers and get those : 2) the code returned ( eg: 200 for success, 404 for not found, .. etc ). 3) a key-array with all the objects returned ( like $objects["Content-type"]; $objects["Server-software"]; ) ( not sure about there name, i think that they were called objects but don't knoe why ! ) of course the $objects["Location"] will be most usefull in case of redirection. 4) an array of all the cookies that are supposed to be set where each element is a key-array containig the cookies name, value, expiration date, .. and all the information sent by the server. NOTE : this class is to be used to deal with remote web sites as objects, so it's not intended to be used with the current running script as an http resource it self ( ie; it's not to be used as a basic authentication library for your current website, it's Basic authentication support is to make it able to connect to other websites requiring basic authentication ). Thought i better say that i have this class before anybody starts making one, waiting for approval to start and i think it'll be Net_HTTP.php, and i'll make it to use the pear Socket classes ( just like the SMTP class ). any ideas are welcomed and yes, excuse me for my language ;) -- mubarmej

« previous php.pear (#760) next »