You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Naveen Gupta <nk...@gmail.com> on 2011/06/10 06:48:38 UTC
ERROR on posting update request using CURL in php
Hi
This is my document
in php
$xmldoc = '<add><doc><field name="id">F_146</field><field
name="userid">74</field><field name="groupuseid">gmail.com</field><field
name="attachment_size">121</field><field
name="attachment_name">sample.pptx</field></doc></add>';
$ch = curl_init("http://localhost:8080/solr/update");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:
text/xml") );
curl_setopt($ch, CURLOPT_POSTFIELDS,$xmldoc);
$result= curl_exec($ch);
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
$header = substr($response, 0, $info['header_size']);
echo 'Took ' . $info['total_time'] . ' seconds to send a
request to ' . $info['url'];
}else{
print_r('no idea');
}
println('result of query'.' '.' -> '.$result);
It is throwing error
<html><head><title>Apache Tomcat/6.0.18 - Error report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 400 - Unexpected character ''' (code 39) in
prolog; expected '<'
at [row,col {unknown-source}]: [1,1]</h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u>Unexpected character ''' (code 39) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]</u></p><p><b>description</b> <u>The
request sent by the client was syntactically incorrect (Unexpected character
''' (code 39) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]).</u></p><HR size="1"
noshade="noshade"><h3>Apache Tomcat/6.0.18</h3></body></html>
Thanks
Naveen
Re: ERROR on posting update request using CURL in php
Posted by Naveen <nk...@gmail.com>.
Hi,
Basically i need to post something like this using curl in php
The example of php explained in earlier thread,
curl http://localhost:8983/solr/update?commit=true -H "Content-Type:
text/xml" --data-binary '<add><doc><field
name="id">testdoc</field></doc></add>'
Should we need to create a temp file and using put command
can we do it using post
Regards
Naveen
--
View this message in context: http://lucene.472066.n3.nabble.com/ERROR-on-posting-update-request-using-CURL-in-php-tp3047312p3047372.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: ERROR on posting update request using CURL in php
Posted by Naveen Gupta <nk...@gmail.com>.
Hi,
curl http://localhost:8983/solr/update?commit=true -H "Content-Type:
text/xml" --data-binary '<add><doc><field
name="id">testdoc</field></doc></add>'
Regards
Naveen
On Fri, Jun 10, 2011 at 10:18 AM, Naveen Gupta <nk...@gmail.com> wrote:
> Hi
>
> This is my document
>
> in php
>
> $xmldoc = '<add><doc><field name="id">F_146</field><field
> name="userid">74</field><field name="groupuseid">gmail.com</field><field
> name="attachment_size">121</field><field
> name="attachment_name">sample.pptx</field></doc></add>';
>
> $ch = curl_init("http://localhost:8080/solr/update");
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
> curl_setopt ($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:
> text/xml") );
> curl_setopt($ch, CURLOPT_POSTFIELDS,$xmldoc);
>
> $result= curl_exec($ch);
> if(!curl_errno($ch))
> {
> $info = curl_getinfo($ch);
> $header = substr($response, 0, $info['header_size']);
> echo 'Took ' . $info['total_time'] . ' seconds to send a
> request to ' . $info['url'];
> }else{
> print_r('no idea');
> }
> println('result of query'.' '.' -> '.$result);
>
> It is throwing error
>
> <html><head><title>Apache Tomcat/6.0.18 - Error
> report</title><style><!--H1
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
> H2
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
> H3
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
> BODY
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
> P
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
> </head><body><h1>HTTP Status 400 - Unexpected character ''' (code 39) in
> prolog; expected '<'
> at [row,col {unknown-source}]: [1,1]</h1><HR size="1"
> noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
> <u>Unexpected character ''' (code 39) in prolog; expected '<'
> at [row,col {unknown-source}]: [1,1]</u></p><p><b>description</b> <u>The
> request sent by the client was syntactically incorrect (Unexpected character
> ''' (code 39) in prolog; expected '<'
> at [row,col {unknown-source}]: [1,1]).</u></p><HR size="1"
> noshade="noshade"><h3>Apache Tomcat/6.0.18</h3></body></html>
>
>
> Thanks
> Naveen
>
>
>