SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Google Search with PHP

    I have seen numerous sites with a search box on, and when you type something in and hit the submit button it searches google but returns the results as part of the site, not the proper google search results page, if you see what I mean. I'm pretty sure this can be done using PHP. Anyone have any idea how?

    -Sam
    Sam Hastings

  2. #2
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google.com -> View -> Source -> Search "Google Search" (the submit button) -> Select whole form -> Copy -> Paste into yourfile.php -> save -> Upload -> Test it -> if it doesn't work -> Don't blame me -> I'm out of contorl -> With these little arrows, -> however -> it should work -> becusae it would use the same field names -> good luck -> Regards, -> Someonewhois

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the entertaining post.

    However, this is not what I want as this will just bring up Google's traditional results page and I want the results to be seamlessly displayed in my site.

    -Sam
    Sam Hastings

  4. #4
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I've recoverd


    This oughta do it; however I take no lawsuit claims if google catches you donig this I don't knwo how legal this is


    PHP Code:
    <form action="/search" name=f><table cellspacing=0 cellpadding=0><tr valign=middle><td width=75>&nbsp;</td><td align=center><input maxLength=256 size=55 name=q value="">
    <
    script>
    document.f.q.focus();
    </script>
    <input type=hidden name=ie value="ISO-8859-1"><input name=hl type=hidden value=en><br><input type=submit value="Google Search" name=btnG><input type=submit value="I'm Feeling Lucky" name=btnI></td><td valign=top nowrap><font size=-2>&nbsp;•&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;•&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;•&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr><tr><td colspan=3 align=center><font size=-1>Search: <input type=radio name=meta value="" checked> the web<input type=radio name=meta value="cr=countryCA" > pages from Canada</font></td></tr></table></form><p><font size=-1><p></font><br>Google.ca offered in: <a href="http://www.google.ca/fr">French</a> <br>&nbsp;<br><br><font size=-1><a href="/ads/">Advertise&nbsp;with&nbsp;Us</a> - <a href="/services/">Search&nbsp;Solutions</a> - <a href="/news/">News and Resources</a> - <a href="/options/">Services&nbsp;&amp;&nbsp;Tools</a> - <a href=/about.html>Jobs,&nbsp;Pres 

    Erm, good luck

  5. #5
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    UK
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nah, what he means is full integration with the google web API, which I've got on a design, by COINCIDENCE

    http://techsited.co.uk/template.php

    So he needs to go around searching for google web api, not giving him any more help because he's **** ******* theiving ****.

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Karl, I think...

    I didn't think you were so open about your design template

    -Sam
    Sam Hastings

  7. #7
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of posting the search fields back to yahoo, you could post them to your own page, which then creates the yahoo-esque url, does a file read on that location, then parses the returned file.

    Of course, I'm not going to write teh code for you to do that though.

  8. #8
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's ok, I've got it working now, with a little (reluctant) help from Mr. TechSited.

    -Sam
    Sam Hastings


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •