PX : code

PHP Search by Fraser Campbell
Download this code


<?
###################################################### 
#                          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;
        }
}
?

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.