در این قسمت به شرح پیاده سازی متد ها بر ��ساس Restful Api در زبان Php می پردازیم. به این منظور یک تابع عمومی در این بخش تعریف می شود که برای پیاده سازی هر متد از آن استفاده خواهیم کرد. تابع SendRequest را به صورت زیر در پروژه خود تعریف کنید.

{{:: 'controllers.documentation.chooseFramework' | translate }}
function post($url, $postVars = array()){ $postStr = http_build_query($postVars); $options = array( 'http' => array( 'method' => 'POST', //We are using the POST HTTP method. 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postStr //Our URL-encoded query string. ) ); $streamContext = stream_context_create($options); $result = file_get_contents($url, false, $streamContext); if($result === false){ $error = error_get_last(); throw new Exception('POST request failed: ' . $error['message']); } return $result; }