Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send data via using POST in Zend_Rest_Client

There is the next code:

$client = new Zend_Rest_Client('http://test.com/rest');
$client->sendData('data');

if i send via GET (echo $client->get()) it works correct

if via POST (echo $client->post()) i'm getting the next message "No Method Specified."

how to send post using Zend_Rest_Client?

like image 234
John W. Avatar asked Jan 18 '11 14:01

John W.


1 Answers

Maybe this helps:

$base_url = 'http://www.example.com';
$endpoint = '/path/to/endpoint';
$data = array(
    'param1' => 'value1',
    'param2' => 'value2',
    'param3' => 'value3'
);
$client = new Zend_Rest_Client($base_url);
$response = $client->restPost($endpoint, $data);
print_r($response);
like image 152
scoffey Avatar answered Oct 18 '22 22:10

scoffey