note 67825 added to function.fsockopen
| From: | phpatmacosbraindotcom at osu1 dot php dot net | Date: | Wed, 05 Jul 2006 19:57:53 +0000 |
| Subject: | note 67825 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114404@lists.php.net to get a copy of this message | ||
i just create a small class that handle requests to websites over php.
-it include post/get/...
-you can set cookies
-upload files
-add custom header information
-and much more
information (in german) and a zip file with the download under:
http://macosbrain.ath.cx/wordpress/2006/07/02/http-request-mit-php/
here just a usage examlpe. the code was to long for a note in php.net.
<?php
//Usage example:
////method, host, file, port(optional), http_v(optional)
//$request = new
http_request('POST','macosbrain','/nvtracker/test.php');
////use a proxy server for request -> optional
//$request->proxy('192.168.0.1',8080);
////add some header informations
//$request->add_header('Accept','text/plain');
////add some header informations
//$request->add_header('User-Agent','Firefox/1.5.0.4');
////add some header informations
//$request->add_header('Referer','http://localhost');
//$cookies = array(
//'uid' => 3,
//'pass' => 'testpass',
//'PHPSESSID' => '123456789');
//$request->add_cookies($cookies); /// add the cookies to the request
//$request->add_data('disk','on'); // add "disk" with value
"on"
//$request->add_data('test','123');// add "test" with value
"123"
////add a real file, with fake name(like an upload)
//$request->add_file('file_1', "test.jpg",
$request->get_bin_file_content('C:\\small.JPG'));
////add a custom "file" (like an upload)
//$request->add_file('file_2',"nice_dummy.txt",'content in the
file');
//$request->send();///send the request
//echo('---------packet send--------');
//print_r($request->packet);
//echo('---------send_header---------');
//print_r($request->send_header);
//echo('---------send_data---------');
//print_r($request->send_data);
//echo('---------response from host---------');
//print_r($request->response);
?>
----
Server IP: 66.163.161.117
Probable Submitter: 84.189.236.59
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- http://master.php.net/note/edit/67825
Del: integrated -- http://master.php.net/note/delete/67825/integrated
Del: useless -- http://master.php.net/note/delete/67825/useless
Del: bad code -- http://master.php.net/note/delete/67825/bad+code
Del: spam -- http://master.php.net/note/delete/67825/spam
Del: non-english -- http://master.php.net/note/delete/67825/non-english
Del: in docs -- http://master.php.net/note/delete/67825/in+docs
Del: other reasons-- http://master.php.net/note/delete/67825
Reject -- http://master.php.net/note/reject/67825
Search -- http://master.php.net/manage/user-notes.php