read from and written to a file.
<?php
-$r = new HttpRequest('http://www.google.com');
+$r = new HttpRequest('http://www.google.com/search');
// store Googles cookies in a dedicated file
+touch('google.txt');
$r->setOptions(
- array( 'cookiestore' => '../cookies/google.txt',
+ array( 'cookiestore' => 'google.txt',
)
);
);
// HttpRequest::send() returns an HttpMessage object
-// of type HttpMessage::RESPONSE or throws an exception
+// of type HttpMessage::TYPE_RESPONSE or throws an exception
try {
print $r->send()->getBody();
} catch (HttpException $e) {
)
);
// add the file to post (form name, file name, file type)
+touch('profile.jpg');
$r->addPostFile('image', 'profile.jpg', 'image/jpeg');
try {
if ($this->namespace) {
$method = $this->namespace .'.'. $method;
}
- $this->request->setPostData(xmlrpc_encode_request($method, $params));
+ $this->request->setRawPostData(xmlrpc_encode_request($method, $params));
$response = $this->request->send();
if ($response->getResponseCode() != 200) {
throw new Exception($response->getBody(), $response->getResponseCode());