我一直在使用這個例子錯誤JSON編碼和解碼的Oauth API - PHP
http://code.google.com/p/oauth-php/wiki/ConsumerHowTo#OAuth_Consumer
而且在消費者頁我傳遞的PARAMS作爲JSON編碼字符串創建一個PHP的OAuth API。
$key = '35345345345vertrtertert'; // fill with your public key
$secret = 'h rtyrtyr767567567567'; // fill with your secret key
$url = "www.server.com/serverurl.php";
$options = array('consumer_key' => $key, 'consumer_secret' => $secret);
OAuthStore::instance("2Leg", $options);
$method = "POST";
$params = array(
'radius' => '50',
'latitude'=>'13.35',
'longitude'=>'17.35'
);
$params = json_encode($params);
而在服務器頁面(即serverurl.php)正在打印使用
print_r($_REQUEST);
請求和我使用JSON解碼解碼的字符串,但我得到這個值作爲
Array
(
[radius] => 50
[latitude] => 13_35
[longitude] => 17_35
)
.
被_
取代經緯度 如何管理這個
如果一直這樣做,只需執行'str_replace()'。這是一個冒險的解決方案,但它會起作用。 – Matt 2012-08-03 14:20:15
但我不認爲這是很好的解決方案:) – Warrior 2012-08-03 14:21:12