K, After installing the latest PECL for Solr in PHP I found that it fails
with Solr 6.1.0. This is Debian 8.

Anyway, I just ended up writing a function using curl to post JSON to Solr.
This is working with PHP5.6 & The latest Solrcloud

No more Solr client in PHP for me lol.

Parallel SQL is a reality in 6

Simple function as follows

<?php

$solrserver = "127.0.0.1";
$collection = "products";

////////////// Stick in an include file

function JSONpost($solrserver, $collection, $jsondata) {

$solrPOSTurl = 
"http://".$solrserver.":8983/solr/".$collection."/update/json/docs?commit=true";;



$ch =
curl_init($solrPOSTurl);


curl_setopt($ch, CURLOPT_CUSTOMREQUEST,
"POST");

curl_setopt($ch, CURLOPT_POSTFIELDS,
$jsondata);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,
true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(

    'Content-Type:
application/json',

    'Content-Length: ' .
strlen($jsondata))

);



$result = curl_exec($ch);

return $result;

}


///////////////////////////////////////////////////////////////////////////////
End sitck in include


//// in your page

$data = array("id" => "55i", "name" => " WTF Hagrid");
$json_data_string = json_encode($data);


JSONpost($solrserver, $collection, $json_data_string);


?>



On 2 August 2016 at 08:57, GW <thegeofo...@gmail.com> wrote:

> best to get a build document together to ensure your server is correct.
>
> testing with a simple curl get/post
>
> I use PHP and Perl all the time and have to say the overall docs suck
> because the technology changes fast. The coolest thing about Solrcloud is
> it changes fast. For instance apt-get php5-solr on Ubuntu/Debian will give
> you a very old client. It's so old it is a total waste of time. The Pear
> libs are where you need to be. I'm trying to use Solrcloud 6.1.0 and what
> used to work for 6.0.1
>
>
> So it would appear that a strong ability with REST clients would be the
> answer.
>
> With my current task I have many JSON data sources and a JSON capable
> repository (Solr). If I use the SolrClient to read/post to the REST api,
> the data is read into variables and then moved to another set and posted.
>
> With Curl, I can take the JSON string from the server on the left and post
> it directly to the server on the right.
>
> I'm just refining the functions. Will send them to you shortly.
>
> At the end of the day, a good knowledge of REST apis is where everything
> happens in PHP. My current problem seems to be with the latest Pecl
> SolrClient and latest Solrcloud so I am reverting to posting with Curl.
> I've been doing my gets with Curl because I had a similar issue 5-6 months
> ago.
>
> I'll post those functions in a hour or so.
>
> Best,
>
> GW
>
> On 2 August 2016 at 01:46, Midas A <test.mi...@gmail.com> wrote:
>
>> Jürgen,
>> we are using Php solrclient  and getting above exception . what could be
>> the reason for the same  please elaborate.
>>
>> On Tue, Aug 2, 2016 at 11:10 AM, Midas A <test.mi...@gmail.com> wrote:
>>
>> > curl: (52) Empty reply from server
>> > what could be the case .and what should i do to minimize.
>> >
>> >
>> >
>> >
>> > On Tue, Aug 2, 2016 at 10:38 AM, Walter Underwood <
>> wun...@wunderwood.org>
>> > wrote:
>> >
>> >> I recommend you look at the PHP documentation to find out what “HTTP
>> >> Error 52” means.
>> >>
>> >> You can start by searching the web for this: php http error 52
>> >>
>> >> wunder
>> >> Walter Underwood
>> >> wun...@wunderwood.org
>> >> http://observer.wunderwood.org/  (my blog)
>> >>
>> >>
>> >> > On Aug 1, 2016, at 10:04 PM, Midas A <test.mi...@gmail.com> wrote:
>> >> >
>> >> > please reply .
>> >> >
>> >> > On Tue, Aug 2, 2016 at 10:24 AM, Midas A <test.mi...@gmail.com>
>> wrote:
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> i am connecting solr with php and getting *HTTP Error 52, and *HTTP
>> >> Error
>> >> >> 20* error *frequently .
>> >> >> what should i do to minimize these issues .
>> >> >>
>> >> >> Regards,
>> >> >> Abhishek T
>> >> >>
>> >> >>
>> >>
>> >>
>> >
>>
>
>

Reply via email to