Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/07/2011, 16:06
Avatar de rodrypaladin
rodrypaladin
Moderador
 
Fecha de Ingreso: abril-2010
Ubicación: Madrid
Mensajes: 2.127
Antigüedad: 14 años, 1 mes
Puntos: 468
Error en plugin de twitter

Hola a todos, estoy intentando añadir un código para añadir un enlace que muestra los seguidores en twitter... pero al añadirlo da un error...

el código es el siguiente

Cita:
<?php
function string_getInsertedString($long_string,$short_strin g,$is_html=false){
if($short_string>=strlen($long_string))return false;
$insertion_length=strlen($long_string)-strlen($short_string);
for($i=0;$i<strlen($short_string);++$i){
if($long_string[$i]!=$short_string[$i])break;
}
$inserted_string=substr($long_string,$i,$insertion _length);
if($is_html && $inserted_string[$insertion_length-1]=='<'){
$inserted_string='<'.substr($inserted_string,0,$in sertion_length-1);
}
return $inserted_string;
}

function DOMElement_getOuterHTML($document,$element){
$html=$document->saveHTML();
$element->parentNode->removeChild($element);
$html2=$document->saveHTML();
return string_getInsertedString($html,$html2,true);
}

function getFollowers($username){
$x = file_get_contents("http://twitter.com/descargasandroi");
$doc = new DomDocument;
@$doc->loadHTML($x);
$ele = $doc->getElementById('follower_count');
$innerHTML=preg_replace('/^<[^>]*>(.*)<[^>]*>$/',"\\1",DOMElement_getOuterHTML($doc,$ele));
return $innerHTML;
}
?>

function getFollowers($username){
$x = file_get_contents("http://twitter.com/descargasandroi");
$doc = new DomDocument;
@$doc->loadHTML($x);
$ele = $doc->getElementById('follower_count');
$innerHTML=preg_replace('/^<[^>]*>(.*)<[^>]*>$/',"\\1",DOMElement_getOuterHTML($doc,$ele));
return $innerHTML;
}
?>
y uso para llamarlo:

Cita:
<?php echo getFollowers("descargasandroi")." +"; ?>
Pero el problema me surge que cuando añado el código en mi web, el mismo código en otra web si que funciona pero en cambio no se porque pero en la mia da el siguiente error:

Cita:
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/35/d362115154/htdocs/wp-content/themes/android/subscribe.php on line 48

Warning: file_get_contents(http://twitter.com/Tutorialzine) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/35/d362115154/htdocs/wp-content/themes/android/subscribe.php on line 48

Fatal error: Call to a member function removeChild() on a non-object in /homepages/35/d362115154/htdocs/wp-content/themes/android/subscribe.php on line 42
__________________
No te olvides de dar +1 a quien te echa un cable ;)