$xml_file = file_get_contents(SITE_PATH . 'cms/data.php');
The problem is that a server has URL file-access disabled. I cannot enable it, its a hosting thing.
So the question is this. The data.php
file generates xml code.
How can I execute this and get the xml data without doing the above method?
Is it possible?
Use cURL. This function is an alternative to file_get_contents
.
function url_get_contents ($Url) {
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}