Greetings, I just started using the keyword tracker recently. I noticed that the script dpkwt.php causes error in my php logs each time I update the keywords. The error I get is ... [Fri Oct 30 08:42:23 2009] [error] [client 216.9.35.51] PHP Warning: Invalid argument supplied for foreach() in /home/<dir>/public_html/<mysite>/dpkwt.php on line 70 My programmer maDe the following comment on this error.. I just thought I would pass that along to Shawn.
Yeah I know... it's throwing that error when there are no results. I've been meaning to change it so it doesn't throw the error (beyond being in your log file it doesn't hurt anything, so it hasn't been a huge priority).
Yeah, the only reason we noticed it is becuse we are tracking down a bug on my site, and went to the php logs to see if it threw an error. Unfortunately, this error took up the whole log, so we couldn't see anything, lol. I'll go ahead and make this change to the file on my server, as long as that's ok with you.
My programmer wants to know, when there are no results, is it still an array? This is the fix he proposed... if ( ($_REQUEST['u']) && (is_array($parser['responseData']['results'])) )
The fix you listed would only work for Google... I went ahead and updated the script at the normal location to suppress the errors for Google, Yahoo and Bing, so just use that one... http://www.digitalpoint.com/tools/keywords/advanced_script.html
The following fix should validate the string to make sure is an array and that is not empty: if ($_REQUEST['u'] && is_array($parser['responseData']['results']) && (count($parser['responseData']['results']) > 0) ) Code (markup):