Я должен отправить запрос GET на удаленный сервер, чтобы получить некоторые данные JSON с PHP. Но я получаю окно предупреждения с ошибкой:
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);
http://example.com/&clientId=m&clientSecret=m
неверный URL; Первый&
должен быть?
, вот почему его 404