Repository navigation
HttpSocket changes
The HttpSocket class has undergone some changes.
Following others places in core, the HttpSocket do not change the helpers. The RFC 2616 says that helpers are case insensitive.
So, if your server send the below header:
HTTP/1.1 200 OK
Date: Mon, 16 Apr 2007 04:14:16 GMT
server: CakeHttp Server
content-tyPe: text/htmlYou $http->response['header'] will be:
Array(
'Date' => 'Mon, 16 Apr 2007 04:14:16 GMT',
'server' => 'CakeHttp Server',
'content-tyPe' => 'text/html'
)The methods get(), post(), put(), delete() and request() now returns the content as reference. It is good when the server response is big. The reference is to $http->response['body']. To use it, you need receive the result with reference, for example:
$response =& $http->get('http://www.cakephp.org');HttpSocket have a new method called setContentResource(). Setting a resource with this method the content will be wrote to this resource, using fwrite(). To you download a file, you can do:
$http = new HttpSocket();
$f = fopen('feed.xml', 'w');
$http->setContentResource($f);
$http->get('http://www.example.com/feed.xml');
fclose($f);Attention: The header is not included in file.
Now you can create your authentication method to use with HttpSocket.