2011-09-20 103 views

回答

1

嘗試

<?php 

//make http request 
$response = file_get_contents('https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&q=hello%20world&source=en&target=de'); 

//decode json to array 
$json = json_decode($response); 

//show the json array in a readable format 
echo '<pre>'; 

//show array 
print_r($json); 

?> 

然後,您可以訪問特定的節點與echo $json['key_name']

有用網址:

http://php.net/manual/en/function.file-get-contents.php

http://php.net/manual/en/function.json-decode.php