note 75404 rejected from ref.curl by nlopess

From: Date: Tue, 19 Jun 2007 12:06:51 +0000
Subject: note 75404 rejected from ref.curl by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127736@lists.php.net to get a copy of this message
Note Submitter: eugene at baddot dot com ---- hi everyone i have did some codes to detect the code from a third party website ?> $filename = "http://www.baddot.com" ; $dataFile = fopen( $filename, "r" ) ; if ( $dataFile ) { while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); //$myfile = html_entity_decode($buffer); full link without picture $myfile = htmlentities($buffer); if($myfile == "%.jpg"){ echo $myfile . "<br>"; echo "I got a picture named"; } } fclose($dataFile); } else { die( "fopen failed for $filename" ) ; } ?> but i have some problems which the script does not work even if the curl also wont work too can anyone help ? <?function html_to_array( $url, $element = null ){ if( !( $data = file_get_contents( $url ) ) ) return false; preg_match_all( '~<img.*?>(</img>)?~si', $data, $page['img'] ); preg_match_all( '~<div.*?>.*?[^<]</div>~', $data, $page['div'] ); preg_match_all( '~<style.*?>.*?[^<]</style>~', $data, $page['Inline_Css'] ); preg_match_all( '~<link.*?>~', $data, $page['Linked_Css'] ); preg_match_all( '~<meta.*?[^>]>~', $data, $page['Meta'] ); preg_match_all( '~<a.*?[^>].*[^<]</a>~', $data, $page['Link'] ); return !is_null( $element ) ? $page[ $element ] : $page ;}function display_links( $links, $htmlentities = true ){ foreach( $links as $number => $link ) { printf("Link number %d : [ %s ]<br />\n", $number + 1, $htmlentities ? htmlentities( $link ) : $link ); } } foreach( html_to_array( 'http://forums.digitalpoint.com' ) as $element => $html ){ printf( "I see %d %s tags<br />\n", count( $html[0] ), str_replace('_', ' ', $element ) );} foreach( html_to_array( 'http://forums.digitalpoint.com', 'Link' ) as $links ){ printf("I found %d links, here they are :<br />\n%s", count( $links ), display_links( $links ) );} ?>

« previous php.notes (#127736) next »