當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Rest_Client::post方法代碼示例

本文整理匯總了PHP中Zend_Rest_Client::post方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Rest_Client::post方法的具體用法?PHP Zend_Rest_Client::post怎麽用?PHP Zend_Rest_Client::post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Rest_Client的用法示例。


在下文中一共展示了Zend_Rest_Client::post方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

    foreach ($tasks->task as $task) {
        echo "\t<li>" . $task->name . "</li>\n";
        echo "\t<ul>\n";
        echo "\t\t<li>execute " . $task->{'schedule-method'} . " " . $task->{'schedule-when'} . "</li>\n";
        echo "\t\t<li>created by " . $task->{'created-by'} . " on " . $task->{'created-on'} . "</li>\n";
        echo "\t</ul>\n";
    }
    echo "</ul>\n";
} else {
    echo "<p>There are no scheduled tasks.</p>\n";
}
/**
  Creating a new task, to be executed every 10 seconds
 **/
$data = array('name' => "My Example Task #" . mktime(), 'schedule_method' => "every", 'schedule_when' => "10s", 'action' => array('action_class_name' => "Ruby", 'code' => 'puts "Hello World!"'));
$task1 = $rest->post('/tasks.xml', $data);
/**
  Creating a new task with multiple actions, to be executed 5 minutes from now
 **/
$data = array('name' => "Another Example Task #" . mktime(), 'schedule_method' => "in", 'schedule_when' => "5m", 'actions' => array(array('action_class_name' => "Ruby", 'code' => 'puts "Sending a message through Howlr..."'), array('action_class_name' => "Howlr", 'url' => "http://howlr.example.foo/messages.xml", 'subject' => "Testing", 'from' => "joe@example.foo", 'recipients' => "sally@example.foo", 'body' => "Just testing!", 'username' => "howlr", 'password' => "howl!")));
$task2 = $rest->post('/tasks.xml', $data);
/**
  Retreiving a specific task by its ID
 **/
$id = $task1->id;
$task = $rest->get("/tasks/{$id}.xml");
if ($task) {
    // print the Task's name
    echo $task->name;
    // print the type of the first action in this task
    //echo $task->{'task-actions'}->{'task-action'}[0]->{'action-class-name'};
開發者ID:jumping,項目名稱:taskr,代碼行數:31,代碼來源:php_client_example.php


注:本文中的Zend_Rest_Client::post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。