PHP Classes

Function blocked by host

Recommend this page to a friend!

      Rank Checker  >  All threads  >  Function blocked by host  >  (Un) Subscribe thread alerts  
Subject:Function blocked by host
Summary:file_get_contents, function is blocked by me hosting service
Messages:3
Author:Dwaine Halberg
Date:2011-09-01 04:02:52
Update:2011-09-01 15:09:44
 

  1. Function blocked by host   Reply   Report abuse  
Picture of Dwaine Halberg Dwaine Halberg - 2011-09-01 04:02:54
I have tested in the class works fine on my local development server, but when I deploy to my hosting server I get a message that file_get_contents is blocked for security purposes. got any idea of another php function to replace that with and make the class work?

Thanks!

  2. Re: Function blocked by host   Reply   Report abuse  
Picture of Hamed Afshar Hamed Afshar - 2011-09-01 07:23:27 - In reply to message 1 from Dwaine Halberg
Hello,
You can use fopen and fread instead.
Please replace the line $data=file_get_contents($url); with the following code:

$handle = fopen($url, "rb");
$data = stream_get_contents($handle);
fclose($handle);

  3. Re: Function blocked by host   Reply   Report abuse  
Picture of Dwaine Halberg Dwaine Halberg - 2011-09-01 15:09:44 - In reply to message 2 from Hamed Afshar
Essentially the same warning:
Warning: fopen() [<a href='function.fopen'>function.fopen</a>]: URL file-access is disabled in the server configuration in /path_removed/lib/classes/rankchecker.php on line 38

other errors after this, but all due to this failure..