$ch = curl_init();
//$keyword='hello';
$url = 'http://apis.baidu.com/apistore/tranlateservice/dictionary?query=hello&from=en&to=zh';
$header = array(
'apikey: 这里是我的apikey,我没有写',
);
// 添加apikey到header
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 执行HTTP请求
curl_setopt($ch , CURLOPT_URL , $url);
$res = curl_exec($ch);
curl_close($ch);
var_dump(json_decode($res));