我收到一条错误的红线,javax.ws表示无法解析。我不知道这个错误是否会解决其余问题,但是我应该下载某种类型的库吗?
<?php
class GCM_SendMsg {
function __construct() {
}
/**
* send push notification
*/
public function send_notification($registatoin_ids, $message) {
include_once './config.php';
// Set POST request variable
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registatoin_ids,
'data' => $message,
);
$headers = array(
'Authorization: key=' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// disable SSL certificate support
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
echo $result;
}
}
?>
我设法以某种方式修复它并下载了外部jar,但我仍然有最后一个错误:http://i.imgur.com/3IYfgQG.jpg
答案 0 :(得分:0)
首先,确保在项目上运行“刷新”。如果没有拿起JAR,那么在Eclipse的Project Explorer中导航到它们,右键单击它们,然后在弹出菜单中使用“Build Path”&gt; “添加到构建路径”。