There are a number of ways to access Solr from PHP, and none of them seem to have taken hold of the market as the single best approach. So keep an eye on the wiki page at http://wiki.apache.org/solr/SolPHP for new developments.
Adding the URL parameter, wt=php
, produces simple PHP output in a typical array data structure:
array( 'responseHeader'=>array( 'status'=>0, 'QTime'=>0, 'params'=>array( 'wt'=>'php', 'indent'=>'on', 'rows'=>'1', 'start'=>'0', 'q'=>'Pete Moutso')), 'response'=>array('numFound'=>523,'start'=>0,'docs'=>array( array( 'a_name'=>'Pete Moutso', 'a_type'=>'1', 'id'=>'Artist:371203', 'type'=>'Artist')) ))
The same response using the Serialized PHP output specified by wt=phps
URL parameter is a much less human-readable format that is more compact to transfer over the wire:
a:2:{s:14:"responseHeader";a:3:{s:6:"status";i:0;s:5:"QTime";i:1;s:6:"params...