Debanjan Roy Debanjan Roy - 1 year ago 115
PHP Question

I want to show current GOLD RATE from Gold Price India Site using PHP

Just want to show current gold rate from Gold Price India ( using PHP.

I have done to get data using file_get_contents() method. But its working on localhost but not in server. I want this on my FTP server too.

My Code:

$url1 = '';
$content1 = file_get_contents($url1);
$first_step1 = explode( '<div class="prc">' , $content1 );
$gold_rate1 = explode("</div>" , $first_step1[1] );

I am using PHP, I hope my question is clear if not I ready to explain again.

Thank You.

Answer Source

may be your server disabled URL file access may be you can try alternate solution to get file content.

Alternate method to get file content

   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);
return $output;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download