https://github.com/gera2ld/phpfetching
Web fetcher written in PHP, supporting cookie files.
https://github.com/gera2ld/phpfetching
Last synced: 12 months ago
JSON representation
Web fetcher written in PHP, supporting cookie files.
- Host: GitHub
- URL: https://github.com/gera2ld/phpfetching
- Owner: gera2ld
- Created: 2014-12-24T06:12:44.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-11-01T16:20:47.000Z (over 10 years ago)
- Last Synced: 2025-01-15T05:52:53.572Z (over 1 year ago)
- Language: PHP
- Size: 184 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Fetcher for PHP
===
This is a simple web resource fetcher written in PHP,
with cookies support.
Requires PHP 5.3+. File uploading requires PHP 5.5+.
Also works with lower versions of PHP if namespace lines are removed.
Usage
---
``` php
fetch('http://www.google.com');
// POST
$res=$fetcher->fetch('http://www.google.com','data');
// **Output**
// * status code
echo $res->status;
// * final url
echo $res->url;
// * binary
echo $res->content;
// * text
// default encoding is 'utf-8'
echo $res->text;
// * text: change encoding
$res->encoding='gbk';
echo $res->text;
// * json
echo $res->json(); // returns an object
echo $res->json(true); // returns an array
```