获取请求PHP时出错


Error Get request PHP

我必须向远程服务器发送GET请求,才能使用PHP获取一些JSON数据。但我得到警报窗口错误:

 Failed to load resource: the server responded with a status of 404 (Not Found)
    http://duty.megafon.tj/VAADIN/vaadinBootstrap.js?v=7.4.3 
Failed to load resource: the server responded with a status of 404 (Not Found)
    l.php:22 Uncaught ReferenceError: vaadin is not defined

这是我的PHP代码:

@curl_setopt($ch, CURLOPT_URL, 'http://example.com/&clientId=m&clientSecret=m');
@curl_setopt($ch, CURLOPT_HEADER, false);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,30);
@curl_setopt($ch,CURLOPT_USERAGENT,'(http://example.com/&clientId=m&clientSecret=m)');
$date = curl_exec($ch);
echo($date);
@curl_close($ch);

尝试将您的PHP代码更改为:

@curl_setopt($ch, CURLOPT_URL, 'http://example.com/?clientId=m&clientSecret=m');
@curl_setopt($ch, CURLOPT_HEADER, false);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,30);
@curl_setopt($ch,CURLOPT_USERAGENT,'(http://example.com/&clientId=m&clientSecret=m)');
$date = curl_exec($ch);
echo($date);
@curl_close($ch);