atk14/url-fetcher
最新稳定版本:v1.8.6
Composer 安装命令:
composer require atk14/url-fetcher
包简介
Class providing methods to make http requests
关键字:
README 文档
README
UrlFetcher is a PHP class providing methods to make http requests
Basic usage
$fetcher = new UrlFetcher("http://www.example.com/content.dat");
if(!$fetcher->found()){
echo $fetcher->getErrorMessage();
exit(1);
}
$content = $fetcher->getContent();
$status_code = $fetcher->getStatusCode(); // e.g 200
$content_type = $fetcher->getContentType(); // e.g. "application/pdf"
$request_headers = $fetcher->getRequestHeaders();
$response_headers = $fetcher->getResponseHeaders();
HTTP basic authentication or non-standard port can be specified within the URL.
$fetcher = new UrlFetcher("https://username:password@www.example.com:444/private/content.dat");
if($fetcher->found()){
echo $fetcher->getContent();
}else{
echo $fetcher->getErrorMessage();
}
Make a POST requests
$fetcher = new UrlFetcher("https://www.example.com/api/en/articles/create_new/");
if($fetcher->post(["title" => "Sample article", "body" => "Lorem Ipsum..."])){
echo $fetcher->getContent();
}
Installation
Use the Composer to install the UrlFetcher.
cd path/to/your/project/
composer require atk14/url-fetcher
Licence
UrlFetcher is free software distributed under the terms of the MIT license
统计信息
- 总下载量: 42.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-24