Jump to content

nickmorri

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by nickmorri

  1. Oh boy, certainly didn't notice that till just now. I seem to have got it to work with this. Thank you for the Google tip as well. require_once('workflows.php'); $wf = new Workflows(); $orig = "{query}"; $transport = $wf->request("http://myserver.com/whatsearch/autocomplete.php?artist=".urlencode($orig)); $suggestions = json_decode($transport); foreach($suggestions as $name => $id) { $wf->result($id, $id, $name, 'Search Site for '.$name, 'icon.png'); } echo $wf->toxml();
  2. I am trying to use a JSON encoded PHP array to supply autosuggestion results to Alfred from a PHP file I have control over. This is the JSON data I am returning from my a request such as this: http://myserver.com/search/autocomplete.php?artist=The {"The Bulletproof Tiger":"245461","The Good Earth Project":"245462","The Skywalker Symphony Chorus":"891858","The Gaslamp Killer":"46450","The Buchanans":"684229","The High Llamas":"17170","The Pastels":"19504","The Lower Mills":"589814","The Head and the Heart":"392379","The Super 3":"697422"} This what my Alfred script looks like so far require_once('workflows.php'); $wf = new Workflows(); $orig = "{query}"; $transport = $wf->request("http://http://myserver.com/search/autocomplete.php?artist=".urlencode($orig)); $suggestions = json_decode($transport); foreach($suggestions as $name => $id): $wf->result($id, $id, $name, $name, 'icon.png'); endforeach; $results = $wf->results(); if ( count( $results ) == 0 ) { $wf->result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' ); echo $wf->toxml(); This is my first time really dealing with PHP or Alfred scripts, I feel like I am close but just missing something tiny. What am I missing? Thanks for the help!
×
×
  • Create New...