how do pause this loop for a fixed time frame?
<p>I do have a array which will read text file and do api call and then insert these result to mySQL. but when it run in bulk the response from API server is slow and due to this many of the results are coming blank. what I am looking is is there a way to pause this loop for each call say 5 seconds to get result from api server so it wont get blank results.</p>

<p>this code is below</p>

<pre><code>//connect to your database 
mysql_connect("localhost", "root", "password"); 
mysql_select_db("somedb"); 

//read your text file into an array, one entry per line 
$lines = file('filename.txt'); 

//loop through each website URL  
foreach ($lines as $website_url) { 

    //make the request to the compete API 
    $response = file_get_contents("http://apps.compete.com/sites/" . $website_url . "/trended/rank/?apikey=0sdf456sdf12sdf1"); 

    //decode the request 
    $response = json_decode($request); 

    //get the rank from the response 
    $rank = $response['something'];  

    //insert the website URL and its rank 
    mysql_query("INSERT INTO website_ranks (website_url, rank) VALUES ('" . mysql_real_escape_string($website_Url) . "', " . $rank . ")"); 

} 
</code></pre>
