el código es el siguiente
Cita:
y uso para llamarlo:<?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;
}
?>
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;
}
?>
Cita:
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:<?php echo getFollowers("descargasandroi")." +"; ?>
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
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