ajax - Multiple request in foreach php loop -


i want tweets of list of users , save db. tweets generated in file called tweets.php connects twitter api. if have 1 name, can use file_get_contents tweets , insert them. how do if have array of users?

below illustration of want do. far understand, not possible use file_get_contens variable added (as in script), should use instaed. ajax request way. not quite sure how combine ajax , php in case, , perefer stay in php.

$values = array(0 => 'oscar', 1 => 'peter', 2 => 'paul');   foreach($values $value) {    $tweetjson = file_get_contents('http://localhost/news/tweets.php?name='<?php echo .$value.    ?>)');   $tweetjson  = json_decode($tweetjson, true);    $statement = $dbh->prepare("insert tweet (tweet, title) values (?, ?)");  foreach($tweetjson  $key => $value) { $statement->execute(array($value['text'], $value['user']['name']));  }   }  


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -