1
我試圖用(節點)創建日期參數來檢索視圖。但是,當我通過cURL發送它時,我似乎無法使其正常工作。這裏是我的代碼:發送參數到Drupal視圖(JSON,cURL)
$method = 'views.get';
$hash = hash_hmac('sha256', $timestamp .';'.$domain .';'. $nonce .';'. $method, $api_key);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, 'http://site.com/services/json');
$date = $_GET['date'];
$data = array(
'method' => '"'. $method .'"',
'hash' => '"'. $hash .'"',
'domain_name' => '"'. $domain .'"',
'domain_time_stamp' => '"'. $timestamp .'"',
'nonce' => '"'. $nonce .'"',
'sessid' => '"'. $sessid .'"',
'view_name' => '"frontpage"',
'args' => '"'. $date .'"'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$json_result = curl_exec($ch);
我莫名其妙地猜測它處理指定參數時,它返回[]與,當我刪除「ARGS」 => ....它與通配符設置運行。
您究竟通過HTTP公開您的視圖是什麼? – 2011-03-11 08:16:13