php - file_get_contents not working on the server but working fine on local machine -
i have php script call web service retrieve json data script working fine on local machine not working on online server return empty string
$url = "https://magentoorders.elarabygroup.com/service.asmx/availabletopromise"; try { $contextoptions = array( 'http' => array( 'method' => "post", 'timeout' => 500, 'header' => "accept-language: en\r\n" . "content-type: application/json\r\n". "content-length: 0" ) ); $context = stream_context_create($contextoptions); var_dump(file_get_contents($url, false, $context)); } catch (exception $e) { }
you need check if server allows file_get_contents() open url. check if allow_url_fopen set true in php.ini or server configuration.
you can @ this link more help
information manual
allow_url_fopen boolean
this option enables url-aware fopen wrappers enable accessing url object files. default wrappers provided access of remote files using ftp or http protocol, extensions zlib may register additional wrappers.
the other option use curl
Comments
Post a Comment