2013-03-13 91 views
2

我在使用Restler API Explorer將JSON數據發佈到我的Restler Web Service時出現問題。Restler API Explorer發佈JSON數據

下面是一個例子

/** 
* Inserts a product 
* 
* @param string $product_id {@from body} The SKU for the product 
* @return a product object which contains the product 
*/ 
function post($product_id=NULL, $request_data=NULL){ 

error_log(var_export($request_data,1)); 
} 

當我發佈以下JSON字符串通探險

{ 「PRODUCT_ID」: 「MOO」}

我得到以下日誌中輸出

array ('{____"product_id":_"MOO"}' => '','index_url' => 'index',) 

而如果我使用CURL eg

curl -X POST http://xxx.xxx.xxx/products.json -H "Content-Type: application/json" -d '{"product_id": "MOO"}' 

我得到

array ('product_id' => 'MOO','index_url' => 'index',) 

這是我期望的那樣。

可以任何現貨出了什麼問題?

乾杯 羅布

回答