file_get_contents

One client needs to pull content from another website, using file_get_contents.

php.ini don’t allow you to use file_get_contents function. Even tho you can just edit the file to allow the function to be used, it is not recommended.

Workaround: Use curl function instead.

//$contents = file_get_contents('http://www.kitco.com'); <<--- comment this out

//************** EDIT HERE ****************
//Initialize the Curl session
 $ch = curl_init();
 //Set curl to return the data instead of printing it to the browser.
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 //Set the URL
 curl_setopt($ch, CURLOPT_URL,'http://www.kitco.com');
 //Execute the fetch
 $contents = curl_exec($ch);
 //Close the connection
 curl_close($ch);
 //$contents now contains the contents of $URL
//************** END HERE ****************

$g=substr($contents,strpos($contents,"<td align="center" bgcolor="#f3f3e4">",0)+37,6);

 echo " <tr><td align=left>GOLD :</td><td align=right> " .  $g . "</td></tr>";

This will get you the GOLD value taken from kitco.com website.

Sample:

http://www.pasathai.com/gold.php