Joh*_* W. 6 php rest zend-framework
有下一个代码:
$client = new Zend_Rest_Client('http://test.com/rest');
$client->sendData('data');
Run Code Online (Sandbox Code Playgroud)
如果我通过GET(echo $client->get())发送它是正确的
如果通过POST (echo $client->post())我收到下一条消息"没有指定方法."
如何使用发送帖子Zend_Rest_Client?
也许这有助于:
$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);
Run Code Online (Sandbox Code Playgroud)