PHP实现支持GET,POST,Multipart/form(2)

<?php require('HttpRequest.class.php'); $config = array( 'ip' => 'demo.fdipzone.com', // 如空则用host代替 'host' => 'demo.fdipzone.com', 'port' => 80, 'errno' => '', 'errstr' => '', 'timeout' => 30, 'url' => '/getapi.php', //'url' => '/postapi.php', //'url' => '/multipart.php' ); $formdata = array( 'name' => 'fdipzone', 'gender' => 'man' ); $filedata = array( array( 'name' => 'photo', 'filename' => 'photo.jpg', 'path' => 'photo.jpg' ) ); $obj = new HttpRequest(); $obj->setConfig($config); $obj->setFormData($formdata); $obj->setFileData($filedata); $result = $obj->send('get'); //$result = $obj->send('post'); //$result = $obj->send('multipart'); echo '<pre>'; print_r($result); echo '</pre>'; ?>

完整实例代码可以点击此处本站下载

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/8d95517ddd87430f5c15837dbf303e0e.html