dsyph3r / curl-php Goto Github PK
View Code? Open in Web Editor NEWSimple PHP Curl Library
License: MIT License
Simple PHP Curl Library
License: MIT License
Changes need to be made to handle HTTP headers according to the HTTP Spec.
name: value
. There maybe any number of white space characters between the name:
and value
part. Library currently will fail to handle this.Example echo $response['response']:
HTTP/1.0 100 Continue
HTTP/1.0 200 OK
Date: Wed, 21 Sep 2011 12:54:49 GMT
Server: Apache/2.2.17 (Ubuntu)
X-Powered-By: PHP/5.3.5-1ubuntu7.2
Set-Cookie: PHPSESSID=9i8mj6uroahvasactro0bmapr0; path=/
cache-control: no-cache
Vary: Accept-Encoding
Content-Length: 223
Connection: close
Content-Type: text/html; charset=UTF-8
my custom data response is ok
Original Code:
$results = array(
'curl_info' => $response['curl_info'],
'status' => $response['curl_info']['http_code'],
'headers' => $this->splitHeaders($responseSplit[0]),
'data' => $responseSplit[1],
);
I changed :
'headers' => $this->splitHeaders($responseSplit[0]),
'data' => $responseSplit[1],
by:
'headers' => $this->splitHeaders($responseSplit[$responseCount-2]),
'data' => $responseSplit[$responseCount-1],
where $responseCount = count($responseSplit);
Example:
$responseSplit = explode("\r\n\r\n", $response['response']);
$responseCount = count($responseSplit);
$results = array(
'curl_info' => $response['curl_info'],
'status' => $response['curl_info']['http_code'],
'headers' => $this->splitHeaders($responseSplit[$responseCount-2]),
'data' => $responseSplit[$responseCount-1],
);
return $results;
Ignoring HTTP status code 100 if exists
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.