simplexml_load_file bing rss failed

Discussion in 'Install/Configuration' started by webhostnix, Oct 10, 2013.

  1. webhostnix

    webhostnix New Member

    Hi,

    I try to scrape bing rss via simplexml_load_file. I run the script 100x. But the result was never reached 100 percent. Please help me whats litespeed parameter that I have to tune. Here is the source code :

    Code:
    <?php
    function shutdown() 
    { 
         $a = error_get_last(); 
         if(is_null($a))
         	echo 'This hosting is not recommended.<br>';
    } 
    register_shutdown_function('shutdown'); 
    ?>
    <div style="font-size:100%">
    
    <?php
    echo 'IP:' . $_SERVER["SERVER_ADDR"] . '<br>';
    $success = 0;
    for($i = 1; $i <= 100; $i++){
    	$result = simplexml_load_file('http://www.bing.com/search?q='.$i.'&format=rss');
    	$result = $result->xpath('//channel/item');
    	
    	$count = count($result);
    	if($count > 0) {
    		$success++;
    		echo '|';
    	}
    	else{
    		echo '-';
    	}
    }
    echo '<br>The Success Rate Simplexml_Load_File = ' . $success/100*100 . '%<br>';
    ?></div>
    
    Thanks

Share This Page