1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Error Caused by Keyword Tracker in dpkwt.php

Discussion in 'Keyword Tracker' started by selectsplat, Oct 30, 2009.

  1. #1
    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.
     
    selectsplat, Oct 30, 2009 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    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).
     
    digitalpoint, Oct 30, 2009 IP
  3. selectsplat

    selectsplat Well-Known Member

    Messages:
    2,559
    Likes Received:
    121
    Best Answers:
    0
    Trophy Points:
    190
    #3
    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.
     
    selectsplat, Oct 30, 2009 IP
  4. selectsplat

    selectsplat Well-Known Member

    Messages:
    2,559
    Likes Received:
    121
    Best Answers:
    0
    Trophy Points:
    190
    #4
    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'])) )
     
    selectsplat, Oct 30, 2009 IP
  5. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    digitalpoint, Oct 30, 2009 IP
  6. emilacosta

    emilacosta Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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):
     
    emilacosta, Oct 30, 2009 IP