https://github.com/wangta69/curl
curl for pondol packages
https://github.com/wangta69/curl
curl laravel php
Last synced: 2 months ago
JSON representation
curl for pondol packages
- Host: GitHub
- URL: https://github.com/wangta69/curl
- Owner: wangta69
- License: mit
- Created: 2018-02-02T01:50:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T03:05:40.000Z (over 4 years ago)
- Last Synced: 2025-03-05T12:46:29.503Z (3 months ago)
- Topics: curl, laravel, php
- Language: PHP
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# curl
## Installation
```
composer require wangta69/curlcomposer require "wangta69/curl @dev"
```
## How to Use
```
use Wangta69\Curl\CurlService;$body = ['name'=>'pondol'];
$headers = ['Connection: Keep-Alive', 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'];$headers[] = 'Host: shop-wiz.com'];
$headers[] = 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0'];
$headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'];
$headers[] = 'Accept-Language: en-US,en;q=0.5'];
$headers[] = 'Accept-Encoding: gzip, deflate'];//#remove this line for readable/greppable formatting
$headers[] = 'Content-Encoding: gzip';//Transfer-Encoding
$headers[] = 'Referer: https://shop-wiz.com/tmp.php'];
$headers[] = 'Cookie: all required cookies will appear here'];
$headers[] = 'Connection: keep-alive'];$curl = new CurlService();
$curl->request('GET', 'http://www.shop-wiz.com', ['body'=>$body, 'headers'=>$headers]);
echo $curl->body();$curl = new CurlService();
$curl->request('POST', 'http://www.shop-wiz.com', ['body'=>$body, 'headers'=>$headers]);
echo $curl->body();-- Cookie
$curl = new CurlService();
$curl->request('GET', 'http://www.shop-wiz.com', ['cookies'=>true]);
$curl->request('GET', 'http://www.shop-wiz.com', ['cookies'=>['filepath'=>'/tmp/my_cookie_file']]);
echo $curl->body();
```### Request Json
```
use Wangta69\Curl\CurlService;$body = json_encode(['name'=>'pondol']);
$curl = new CurlService();
$curl->requestJson('POST', 'http://www.shop-wiz.com', ['body'=>$body, 'headers'=>$headers]);
echo $curl->body();
```