简体   繁体   中英

Error Get request PHP

I must send GET request to remote server to get some JSON data with PHP. But i get Alert window with error:

 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

This is my PHP code:

@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);

Try change your PHP code to:

@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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM