Jump to content

preg match getting me down!

- - - - -

  • Please log in to reply
No replies to this topic

#1
adzeds

adzeds

    Newbie

  • Members
  • PipPip
  • 27 posts
I have been trying to get a search query from a Google image search!

I am working on a web analytic script to collect visitor stats from my website and I am getting many hits from Google image search but can't strip the query from the referral domain.

Here is the URL that is sending the visit:
http://images.google.co.uk/imgres?imgurl=http://www.eaguingamp.co.uk/wp-content/uploads/2009/03/logo_coupe_de_france.jpg&imgrefurl=http://www.eaguingamp.co.uk/&usg=__5krX213tuDs1Ma2ug956uhL7hF8=&h=241&w=237&sz=38&hl=en&start=1&um=1&itbs=1&tbnid=6Mz7HeF8nEFv7M:&tbnh=110&tbnw=108&prev=/images%3Fq%3D[COLOR="red"]french[/COLOR]%2B[COLOR="red"]football[/COLOR]%2B[COLOR="red"]logo[/COLOR]%26um%3D1%26hl%3Den%26tbs%3Disch:1

The words in red are the search query. How can I get this from the domain. On normal search engine queries I m using the following preg_match which works great:

 $match = preg_match('/Fq([a-zA-Z0-9+-]+)/',$refer, $output);

        $querystring = $output[0];

        $querystring = str_replace('&q=','',$querystring);

        $keywords = explode('+',$querystring);

        $keywords = implode(' ', $keywords);

        return $keywords;
Hope someone can help




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users