Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2011, 23:10
MadDunDee
 
Fecha de Ingreso: octubre-2006
Mensajes: 199
Antigüedad: 17 años, 6 meses
Puntos: 3
activar directiva fopen para URLs en PHP

Buenas,

no tengo mucha experiencia en PHP y estoy integrando un servicio web (dribbble.com) en una página. El caso es que en local me funciona perfectamente, pero cuando lo subo al server encuentro que tiene un problema con la directiva fopen. Concretamente el "famoso" error es el siguiente:


Código PHP:
Warningfile_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

Warning
file_get_contents(http://api.dribbble.com//players/simplebits) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

WarningInvalid argument supplied for foreach() in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 33 

Warning
file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

Warning
file_get_contents(http://api.dribbble.com//players//draftees?page=1&per_page=3) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

WarningInvalid argument supplied for foreach() in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 33 

Notice
Undefined propertyPlayer::$players in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/player.php on line 79 

Warning
file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

Warning
file_get_contents(http://api.dribbble.com//players//following?page=1&per_page=10) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

WarningInvalid argument supplied for foreach() in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 33 

Notice
Undefined propertyPlayer::$players in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/player.php on line 69 

Warning
file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

Warning
file_get_contents(http://api.dribbble.com//players//shots?page=1&per_page=4) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 32 

WarningInvalid argument supplied for foreach() in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/base.php on line 33 

Notice
Undefined propertyPlayer::$shots in /homepages/27/d229005224/htdocs/test-mobile/mock-hd-f3-test/php/src/player.php on line 49 
Bien, después de mirar por el foro se habla de la posibilidad de utilizar fosockets para solucionar este problema, pero no tengo experiencia suficiente para implementarlo. Así que por favor, me gustaría saber si podría alguien decirme cómo hacerlo por ejemplo en este caso:

Código PHP:
<?php 

if (preg_match("/base\.php$/"$_SERVER['PHP_SELF'])){ 
    exit(
'No direct script access allowed'); 


/** 
 * Dribbble base API class 
 * 
 * @author Martin Bean <[email protected]
 **/ 
class Base 

    
/** 
     * Dribbble API base URL 
     * 
     * @var string 
     **/ 
    
var $baseUrl "http://api.dribbble.com/"
     
    
/** 
     * undocumented function 
     * 
     * @return void 
     **/ 
    
public function get($url$options=array()) 
    { 
        
$url $this->baseUrl $url
        if (!empty(
$options)) { 
            
$url.= "?" http_build_query($options); 
        } 
        
$result json_decode(file_get_contents($url)); 
        foreach (
$result as $key => $value) { 
            
$this->{$key} = $value
        } 
        return 
$this
    } 
     
    
/** 
     * undocumented function 
     * 
     * @param string $url 
     * @param array  $options 
     * @return string 
     **/ 
    
public function paginated_list($object
    { 
        return 
$object
    } 
}
Agradecería muchísimo cualquier tipo de ayuda.

Muchas gracias!

NOTA: He probado crear un archivo php.ini en cada una de las carpetas donde tengo archivos php como me indicaron desde mi hosting, pero no he conseguido que funcione. Podríais decirme si es correcto esto? Usar el flag de fopen en on ahí. De ser así, podríais poner un ejemplo concreto de su sintaxis, por si fuera que no creara bien el archivo?

NOTA2: Pido disculpas de antemano por si resulta reiterativa esta pregunta, pero no encuentro solución y me es urgente solucionar este asunto.