Solr PHP client vs file_get_contents?

I use PHP to access Solr, and I wonder at one thing.

Why should I use the Solr PHP client when I can use:

$serializedResult = file_get_contents(
                      'http://localhost:8983/solr/select?q=niklas&wt=phps');

to get the result in arrays and then print them? I really do not understand. Are there any richer features with the PHP client?

+5
source share
5 answers

I think for the following reasons:

  • Flexibility
  • Error processing
  • Security concerns
  • Extensibility

All problems are the headache of these ready-made scripts and frameworks. Therefore, if there is a solution for a specific purpose, I would recommend that you go with this, and not do everything on your own.

, , , ..

+4

solr-php-client file_get_contents (@see Apache_Solr_HttpTransport_FileGetContents), Curl. solr-php-client , , URL- w/parameters, . SPC , . , solr-php- Zend Framework, ZF.

, script, , , . , , script, , , .

+1

, solr ( URL- ..).

0

file_get_contents()... php allow_url_open. - , - , .

0

In some cases, however, it makes sense to do file_get_contents (). SolrClient has nothing to collapse a field (this is a patch not available in trunk), so I must either write my own class that mimics SolrClient and SolrQuery if I cannot do this using the PECL library.

0
source

All Articles