Ethan Miller

Unless otherwise noted, all work licensed under : Creative Commons License

PHP Quicklink Script

Jan 26 2007, 12:00PM

Ok, so you may know about Firefox quick searches, which is very nice. But keeping them updated on multiple machines, or new machines can be a pain.

So, after using quick searches for a while, I switched to yubnub, which does something similar, but it's a social app. With yubnub, when setting up a new machine, I just had to add yubnub as a search engine once for each new machine - and I was off and running (the sequence then would be 'ctrl+k' to get to the search bar, then 'g python regex' to do a google search for example).

The disadvantages of yubnub are: You can only add a command if someone else hasn't already added it. Also yubnub goes down fairly frequently.

So - here is my solution: I wrote a simple PHP script that duplicates the quick search, put it on my website, then followed a tutorial on how to create a custom search engine. That's it. I do have to log into my server and modify the array in that script when I want to create a new quicklink - but it's a minor inconvenience. I just install my custom search engine on any new machine I'm working on, and I have all my links available.


$qlarray = array(
	'dpop' 	=> '',
	'dt' 	=> '',
	'du'	=> '',
	'gma' 	=> '',
	'gcal' 	=> '',
	'g' 	=> '',

if(array_key_exists('cmd', $_GET)){
	$action = split(' ', $_GET['cmd'], 2);		
	if(array_key_exists($action[0], $qlarray)){
		$redir = $qlarray[$action[0]];
		if(count($action) > 1){
			// replace %s with remaind of command
			$redir = str_replace('%s', $action[1], $redir);
			// strip %s 
			$redir = str_replace('%s', '', $redir);
		header("Location: $redir");

Tags : code geek php yubnub

blog comments powered by Disqus