Keyword scraper error

Hello

This is my script

it’s scraping keyword from google…

but when run give problem.

2 error:

Maximum execution time of 30 seconds exceeded…

and

my language is Persian and supported utf-8

but can’t scraper persian keyword


and 1 question
how use ajax to display keyword list extracted . w

<?php
if (isset($_POST["keyword"]) && $_POST['keyword'] !== "") {
$alphas1 = range('A', 'Z');
$alphas2 = range('A', 'Z');
$keyword = $_POST['keyword'];
foreach ($alphas1 as $a1) { foreach ($alphas2 as $a2) {
$xml = simplexml_load_file(utf8_encode("http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=$keyword.' '.$a1.$a2"));

foreach ($xml->children() as $child) {
foreach ($child->suggestion->attributes() as $dta) {
echo "<br>";
echo $dta;
}}}}
} else {
?>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">Keyword: <input type="text" name="keyword" required><input type="submit"></form>
<?php
}
?>

You’re making a lot of queries, one after the other, and it’s going over some time out limit. One possibility: use ParallelCurl

1 Like