模拟请求之 HTTP_Request2
2024-08-26 03:22:41
简单安装:
pear install HTTP_Request2
使用例子:
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2('http://localhost/', HTTP_Request2::METHOD_GET);
try {
$response = $request->send();
if (200 == $response->getStatus()) {
echo $response->getBody();
} else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
} catch (HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
详情:http://pear.php.net/manual/en/package.http.http-request2.intro.php
最新文章
- Atitit MATLAB 图像处理 经典书籍attilax总结
- sql 补齐字段位数
- 9.2.4 .net core 通过ViewComponent封装控件
- weiphp布署在sina sae图片显示不了问题
- iOS开发之 用第三方类库实现轮播图
- js中获取样式的俩种方法 style.color和style[&#39;color&#39;] 区别
- Python中的日志管理Logging模块
- Velocity源码分析
- subllime text 创建可复用的代码片段
- Linq to SQL -- Insert、Update、Delete
- scrapy meta信息丢失
- 从Excel表中导入数据时日期格式的验证问题解决
- eos开发(三)使用cleos命令行客户端操作EOS——关于钱包wallet和账户account
- TCP的三次握手和四次挥手图解
- LeetCode Best to buy and sell stock
- 集成源码深度剖析:Fescar x Spring Cloud
- effective C++学习二(仅供个人学习记录,本文摘录effective C++)
- Memcached理解笔2---XMemcached&;Spring集成
- scrapy的简单使用
- Lucene的数值索引以及范围查询