how about its performance?

2007/6/26, Kijiji Xu, Ping <[EMAIL PROTECTED]>:

I had solved this problem,below is my POST code,I used HTTP_Request of
PEAR,it's so simple.thank you all very much .FYI;


private function doPost($url,$postData){
         $req = &new HTTP_Request($url,array(
        'method' => HTTP_REQUEST_METHOD_POST,
        'http' => HTTP_REQUEST_HTTP_VER_1_1));
         $req->addHeader('Content-Type','text/xml; charset=utf-8');
         $req->addHeader('Content-Length',strlen($postData));
         $req->addRawPostData($postData,true);
         $req->sendRequest();
         $response1 = $req->getResponseBody();
         echo $response1."\n";
         return $response1;
}


-----Original Message-----
From: Tristan Vittorio [mailto:[EMAIL PROTECTED]
Sent: 2007年6月25日 21:36
To: solr-user@lucene.apache.org
Subject: Re: I'm using PHP curl post xml command to Solr,Is it the only
way to post data?

Rather than re-inventing the wheel with fsockopen, why don't you use an
existing HTTP client implementation written in PHP:

http://pear.php.net/package/HTTP_Client
http://framework.zend.com/manual/en/zend.http.html
http://scripts.incutio.com/httpclient/
http://www.phpclasses.org/browse/package/576.html

They should all be able to perform the HTTP POST requests that you require
and will be a lot easier to use that writing raw HTTP protocol through a
socket!

regards,
Tristan



On 6/25/07, Kijiji Xu, Ping <[EMAIL PROTECTED]> wrote:
>
> In our product environment, there haven't curl and pecl lib,so...
> If the fsockopen could solve post xml data,I would like to use it.And I
> tried it, but I failed.
>
> -----Original Message-----
> From: Michael Kimsal [mailto:[EMAIL PROTECTED]
> Sent: 2007年6月25日 20:16
> To: solr-user@lucene.apache.org
> Subject: Re: I'm using PHP curl post xml command to Solr,Is it the only
> way to post data?
>
> Using PHP5 (5.1 or higher I think)
> http://us.php.net/manual/en/function.http-post-fields.php
> is available.
>
> From the example on that page:
>
> $fields = array(
>     'name' => 'mike',
>     'pass' => 'passwordt'
> );
> $response = http_post_fields("http://www.example.com/";, $fields);
>
>
> Looks pretty simple, but I haven't tried it yet.
>
> On 6/25/07, Kijiji Xu, Ping <[EMAIL PROTECTED]> wrote:
> >
> > What about fsockopen, Or any other simple method?
> >
> >
> >
> > Thanks
> >
> >
> >
> > --
> >
> > Regards
> >
> > Xp from china
> >
> >
>
>
> --
> Michael Kimsal
> http://webdevradio.com
>




--
regards
jl

Reply via email to