Fix SERP checking php script

I have a php script that checks google SERP's, stores them in a database, and they gives me a report.

The problem is, that when google updated its results page a couple months ago, my script stopped working.

I need someone to fix the script so it can pick up the desired string on the search results page.

I believe this is only a couple lines of code that will need to analyzed and fixed.

The code below is most likely to be where the problem exists.

global $TIME;


global $keywordsfile;

$result = mysql_query("select keyword from keyword where domain = '$getdomain'");

if (!$result) {

die('Invalid query: ' . mysql_error());


$keywordnum = 0; // NUmber of keywords increased in while

while ($keywords = mysql_fetch_row($result))


global $sleeptime;


ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR [url removed, login to view]; .NET CLR [url removed, login to view]; InfoPath.1)');



foreach ($keywords as $line_num => $keyword)


if ($http_requests)



$keywordnum = $keywordnum + 1;

echo ($keywordnum).': '.$keyword.' ...';

for ($x=1; $x<=$max_serps; $x++)


// [url removed, login to view]


echo "... [url removed, login to view]<br/>";

$url='[url removed, login to view]'.urlencode($keyword).'&hl=en&safe=off&start='.($x-1)*10 .'&sa=N&num='.$serp_listings;

//echo $url."\n";


mysql_query("INSERT INTO $mysql_table (domain, keyword, engine, page, data, time) VALUES ('$getdomain','$keyword','[url removed, login to view]','$x', '$data','$TIME')");

$setpage = $x;


// Yahoo

echo "... [url removed, login to view]";

$url='[url removed, login to view]' .urlencode($keyword). '&ei=UTF-8&fr=sfp&n='.$serp_listings.'&b='. ((($x-1) * 10) + 1);

//echo $url."\n";


mysql_query("INSERT INTO $mysql_table (domain, keyword, engine, page, data, time) VALUES ('$getdomain'. '$keyword','yahoo','$x','$data','$TIME')");


// Time delayed


while($time_delayed < $sleeptime)


if (!$time_delayed)

{echo "\n";}


{echo "\r";}

echo "\t".'Pausing: '.sec2hms($sleeptime - $time_delayed).' secs. Runtime: '.sec2hms(time() - $TIME).'. Est. Remaining: '.sec2hms(($sleeptime * ($keywords_count - $line_num - 1)) + ($sleeptime - $time_delayed)).' ('.($keywords_count - $line_num - 1).' keywords left).';






echo "\n<br />";



foreach ($keywords as $line_num => $keyword)



echo ($line_num + 1).': '.$keyword.' ...'."\n";

// Parse [url removed, login to view]



for ($x=1; $x<=$max_serps; $x++)


$QUERY="SELECT data FROM $mysql_table WHERE keyword='$keyword' AND engine='[url removed, login to view]' AND page='$x'";

$RESULT = mysql_query($QUERY);

while($row = mysql_fetch_array($RESULT))


//echo $row[0];

$data=split("<h3 ", $row[0]);

foreach ($data as $line)


if (ereg("class=r><a href=\"(http|https|ftp)://([^/]+)",$line,$regs))



if (strstr($regs[2], $domain) && $TRACKED_G=="-")








Evner: MySQL, PHP

Se mere: php serp, serps script working, php script serp google, serp php code, serp checking script, serps php script, string problem, string b, net fix com, my fix com, infopath report, global p, get my fix, ftp yahoo.com, ftp engine, foreach in php and mysql, c sizeof string, php serp keyword script, php code query google serp, google serp script, php code serp, php serp code, serp script php, google serp php script, serp script

Om arbejdsgiveren:
( 22 bedømmelser ) Colorado Springs, United States

Projekt ID: #970355

Tildelt til:


i am expert in creating search engine scraping. have done several google bing yahoo scraping projects. Examples in PMB

$30 USD in 2 dage
(28 bedømmelser)

6 freelancere byder i gennemsnit $38 på dette job


We can help in your project, please check PMB and our ratings/reviews to get idea of our experience.

$50 USD på 1 dag
(224 bedømmelser)

Ready to fix and deliver the script

$40 USD in 2 dage
(80 bedømmelser)

--Hello Sir, Please check your pm. Thanks.--

$30 USD in 0 dage
(67 bedømmelser)

Hi! Do you mind looking the questions I've sent you? Thanks.

$30 USD in 0 dage
(240 bedømmelser)

Lets start

$50 USD på 1 dag
(92 bedømmelser)

Dear Hiring Manager, I'm interested in your job post involving these skills. I have experiences in coding especially in php and sql . I believe my skills would be suitable for your project. I am available to chat by Flere

$30 USD in 2 dage
(0 bedømmelser)