Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eusonlito/curl
A Simple Curl Interface
https://github.com/eusonlito/curl
Last synced: 6 days ago
JSON representation
A Simple Curl Interface
- Host: GitHub
- URL: https://github.com/eusonlito/curl
- Owner: eusonlito
- Created: 2012-08-22T13:21:37.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-16T11:51:21.000Z (about 12 years ago)
- Last Synced: 2024-10-18T04:24:39.556Z (26 days ago)
- Language: PHP
- Size: 105 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Curl
=====This script works as simple curl interface
You can use to get remote content using GET, POST or CUSTOM methods
Usage
--------
init('https://github.com/');# GET request
$response = $Curl->get('eusonlito.atom');# POST request
$response = $Curl->post('search', array(
'q' => 'curl',
'start_value' => 1,
'type' => 'Everything',
'language' => 'PHP'
));# Custom request
$response = $Curl->custom('DELETE', 'notifications/subscribe', array(
'repository_id' => 0
));# Set Cookie
$Curl->setCookie('logged=1');# Get raw response
$Curl->getResponse();# Get request info
$Curl->getInfo();# Process Json response
$Curl->init('https://api.github.com/');$Curl->setOption(CURLOPT_HTTPHEADER, array(
'Accept: application/json',
'Content-Type: application/json; charset=utf-8',
'Connection: Keep-Alive'
));$Curl->setJson(true);
$Curl->setOption(CURLOPT_SSL_VERIFYPEER, false);
$Curl->setOption(CURLOPT_USERPWD, 'username:password');$response = $Curl->get('user/repos');
# Request a URL outside the main server
$Curl->fullGet('http://google.com/');# Advanced integration (https://github.com/eusonlito/Timer)
include (__DIR__.'/libs/ANS/Timer/Timer.php');$Timer = new Timer;
$Curl->setTimer($Timer);
$response = $Curl->get('user/repos');
foreach ($Timer->get() as $timer) {
echo "\n".sprintf('%01.6f', $timer['total']).' - '.$timer['text'];
}