[英]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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.