WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : This provides a drop down form for searching with different search engines. All the encoding/arguments are set by the program as need for each supported search engine (currently 18)
Categories : HTML, Search Update Picture
Fraser Cambpell
Date : Jan 17th 1999
Grade : 4 of 5 (graded 2 times)
Viewed : 4104
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Fraser Cambpell
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?
##########################################################################
# Internet Search with PHP #
# Fraser Campbell, October 10, 1998 #
# fraser@greynet.net #
# http://www.greynet.net/fraser/ #
##########################################################################
# To use this, save this file as search.php3 in your #
# html directory or somewhere on your server where #
# everyone can use it -- your web server must #
# support PHP3. Use the program by sticking the #
# form below in any of your webpages. I will add #
# more search engines as time permits. #
##########################################################################

#<FORM ACTION="search.php3">
# <INPUT TYPE="text" NAME="SearchString" size="18" VALUE="">
# <SELECT NAME="SearchEngine">
# <OPTION VALUE="Altavista">Search with Altavista
# <OPTION VALUE="Altavista Canada">Search with Altavista Canada
# <OPTION VALUE="Dogpile">Search with Dogpile
# <OPTION VALUE="Excite">Search with Excite
# <OPTION VALUE="Google">Search with Google
# <OPTION VALUE="Goto">Search with Goto
# <OPTION VALUE="HotBot">Search with HotBot
# <OPTION VALUE="Infoseek">Search with Infoseek
# <OPTION VALUE="Inference Find">Search with Inference Find
# <OPTION VALUE="Looksmart">Search with Looksmart
# <OPTION VALUE="Lycos">Search with Lycos
# <OPTION VALUE="Magellan">Search with Magellan
# <OPTION VALUE="Metacrawler">Search with Metacrawler
# <OPTION VALUE="Snap">Search with Snap
# <OPTION VALUE="Starting Point">Search with Starting Point
# <OPTION VALUE="Webcrawler">Search with Webcrawler
# <OPTION VALUE="Yahoo">Search with Yahoo
# <OPTION VALUE="Yahoo Canada">Search with Yahoo Canada
# </SELECT>
# <INPUT TYPE="text" NAME="SearchString" size="18" VALUE="">
# <INPUT TYPE="submit" VALUE="Find!">
#</FORM>

$SearchString = urlencode($SearchString);

if ($SearchEngine == "Altavista") {
if ($SearchString == "") {
Header( "Location: http://www.altavista.com/");
exit;
} else {
Header( "Location: http://www.altavista.com/cgi-bin/query?pg=q&what=web&q=$SearchString");
exit;
}
} else if ($SearchEngine == "Altavista Canada") {
if ($SearchString == "") {
Header( "Location: http://www.altavista.ca/");
exit;
} else {
Header( "Location: http://www.altavista.ca/cgi-bin/query?pg=q&what=web&q=$SearchString");
exit;
}
} else if ($SearchEngine == "Dogpile" ) {
if ($SearchString == "") {
Header( "Location: http://www.dogpile.com/");
exit;
} else {
Header( "Location: http://buck.dogpile.com/texis/search?q=$SearchString&fs=web&ss=stop&to=ten");
exit;
}
} else if ($SearchEngine == "Excite" ) {
if ($SearchString == "") {
Header( "Location: http://www.excite.com/");
exit;
} else {
Header( "Location: http://www.excite.com/search.gw?search=$SearchString");
exit;
}
} else if ($SearchEngine == "Google" ) {
if ($SearchString == "") {
Header( "Location: http://google.stanford.edu/");
exit;
} else {
Header( "Location: http://google.stanford.edu/search?num=20&query=$SearchString");
exit;
}
} else if ($SearchEngine == "Goto" ) {
if ($SearchString == "") {
Header( "Location: http://www.goto.com/");
exit;
} else {
Header( "Location: http://www.goto.com/d/search/?Keywords=$SearchString");
exit;
}
} else if ($SearchEngine == "HotBot" ) {
if ($SearchString == "") {
Header( "Location: http://www.hotbot.com/");
exit;
} else {
Header( "Location:
http://www.hotbot.com/?MT=$SearchString&SM=B&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&OPs=MDRTP");
exit;
}
} else if ($SearchEngine == "Inference Find" ) {
if ($SearchString == "") {
Header( "Location: http://www.infind.com/");
exit;
} else {
Header( "Location: http://www.infind.com/infind/infind.exe?time=10&query=$SearchString");
exit;
}
} else if ($SearchEngine == "Infoseek" ) {
if ($SearchString == "") {
Header( "Location: http://www.infoseek.com/");
exit;
} else {
Header( "Location: http://www.infoseek.com/Titles?col=WW&qt=$SearchString");
exit;
}
} else if ($SearchEngine == "Looksmart" ) {
if ($SearchString == "") {
Header( "Location: http://www.looksmart.com/");
exit;
} else {

Header( "Location: http://www.looksmart.com/r_search?look=&key=$SearchString");
exit;
}
} else if ($SearchEngine == "Lycos" ) {
if ($SearchString == "") {
Header( "Location: http://www.lycos.com/");
exit;
} else {

Header( "Location: http://www.lycos.com/cgi-bin/pursuit?cat=lycos&query=$SearchString");
exit;
}
} else if ($SearchEngine == "Magellan" ) {
if ($SearchString == "") {
Header( "Location: http://www.mckinley.com/");
exit;
} else {
Header( "Location: http://www.mckinley.com/search.gw?c=web&search=$SearchString");
exit;
}
} else if ($SearchEngine == "Metacrawler" ) {
if ($SearchString == "") {
Header( "Location: http://www.metacrawler.com/");
exit;
} else {
Header( "Location: http://www.metacrawler.com/crawler?general=$SearchString");
exit;
}
} else if ($SearchEngine == "Snap" ) {
if ($SearchString == "") {
Header( "Location: http://www.snap.com/");
exit;
} else {
Header( "Location:
http://home.snap.com/search/directory/results/1,61,home-0,00.html?tag=st.sn.fdsb&keyword=$SearchString");
exit;
}
} else if ($SearchEngine == "Yahoo" ) {
if ($SearchString == "") {
Header( "Location: http://www.yahoo.com/");
exit;
} else {
Header( "Location: http://search.yahoo.com/bin/search?p=$SearchString&name=Search");
exit;
}
} else if ($SearchEngine == "Starting Point" ) {
if ($SearchString == "") {
Header( "Location: http://www.stpt.com/");
exit;
} else {
Header( "Location:
http://www.stpt.com/cgi-bin/pwrsrch/searchDirect.cgi?query=$SearchString&search=web");
exit;
}
} else if ($SearchEngine == "Webcrawler" ) {
if ($SearchString == "") {
Header( "Location: http://www.webcrawler.com/");
exit;
} else {
Header( "Location: http://www.webcrawler.com/cgi-bin/WebQuery?searchText=$SearchString");
exit;
}
} else if ($SearchEngine == "Yahoo" ) {
if ($SearchString == "") {
Header( "Location: http://www.yahoo.com/");
exit;
} else {
Header( "Location: http://search.yahoo.com/bin/search?p=$SearchString");
exit;
}
} else if ($SearchEngine == "Yahoo Canada" ) {
if ($SearchString == "") {
Header( "Location: http://www.yahoo.ca/");
exit;
} else {
Header( "Location: http://search.yahoo.ca/search?x=canada&p=$SearchString");
exit;
}
}
?>



A simple class with some HTML output functions that would come in handy for consistent page layout etc.
Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation
news delete create dynamic
Categories : HTML, HTML and PHP
Searches through a local INN server's discussions
Categories : Search, Complete Programs, PHP
Parses HTTP_USER_AGENT so that you can customize your site to different browsers
Categories : HTML, PHP, Complete Programs
How to use META REFRESH to auto refresh an html page after x seconds.
Categories : HTML
Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form
Categories : HTML, PHP, Strings
Clock at Status Bar
Categories : Java Script, HTML, Date Time
CachedFastTemplate class, extends CDI's FastTemplate to allow page caching
Categories : HTML and PHP, HTML, PHP Classes
Java Script Based Navigation
Categories : HTML, Java Script, Navigation
Unobtrusive javascript for maintaining scrollable layer state
Categories : DHTML, Java Script, HTML
Enchancing dd/mm/yyyy forms with unobtrusive javascript
Categories : Java Script, HTML, User Interface, Date Time
Display Slashdot headers on your own site
Categories : HTML and PHP, HTML, PHP
BBCode Formatting String
Categories : PHP, HTML, Regexps, Arrays
color codes for positive and negative numbers
Categories : PHP, MySQL, Databases, HTML
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General