Dreamhost and File Get

If you're having problems with your PHP scripts in Dreamhost, it's probably the File Get command.

You'll need to use curl, so create this function:


// function to replace file_get_contents()
function file_get_the_contents($url) {
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}

Then, whenever you see a line that looks something like:

file_get_contents("http://...");

Change file_get_contents to file_get_the_contents.

Please take note that there's an http:// after file_get_contents. If your PHP code does not show the http, then please leave the file_get_contents as-is.

I hope that solves your PHP script problems in Dreamhost.

[ First posted on 04/30/2008 by Manuel Viloria ]



Do you LIKE this page? Please let us know, and we will publish more of the content that YOU want. Salamat po!


"Yes, I Want To Grow My Financial Life & Get The 11 TrulyRichClub Blessings!"

To Grab This Offer, Click Option Below:

Truly Rich Club Philippine Residents Click Here

Truly Rich Club International Residents Click Here



Visit SupremeWealthAlliance.net ~ Kumita sa Internet, Kahit Super-BUSY Ka

Get In Touch With Manuel Today
Manuel@Viloria.net



  Previous Entry
  Next Entry




Secondthoughts @ Viloria.com
"Invest in yourself, before
others will invest in you."
-- Manuel Viloria


Viloria.com
About Manuel Viloria
Secondthoughts
Archives
Angelhouser
Contact Us
Privacy Statement
RSS Feed


Google Reader


Copyright © 1996 - 2015 by Viloria.com All Rights Reserved.