Created
May 8, 2013 19:18
-
-
Save arunchinnachamy/5542892 to your computer and use it in GitHub Desktop.
This file shows how to consume a SOLR API in your PHP script as a JSON output. The script is easy and less than half a dozen code lines. You can find example and tutorial at SOLR Search in PHP tutorial.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//replace with your query URL | |
$url = "http://127.0.0.1:8080/solr/core1/select/?q=*%3A*&start=0&rows=10&wt=json"; | |
//Executes the URL and saves the content (json) in the variable. | |
$content = file_get_contents($url); | |
if($content) { | |
$result = json_decode($content,true); | |
//prints the content of array on the page. Instead perform the operation you ae interested. | |
var_dump($result); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The tutorial about how to use PHP to connect and search in SOLR can be found at SOLR-PHP Search Tutorial.