Hi,
I am trying to set User-Agent header attribute for an HTTP request with following code snippet.
let $content := http:send-request(<http:request method='get' status-only='false' User-Agent='Mozilla/5.0'/>, $url) let $body := $content[2] return $body
But It is sending "Java/1.7.0_02" as User-Agent header attribute. This has been taken from wireshark:
GET / HTTP/1.1 User-Agent: Java/1.7.0_02 Host: istanbul.olx.com.tr Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Do we have any way to set the user-agent attribute?
Thanks
Erol Akarsu
This may work:
<http:header name="User-Agent" value="blub"/>
The spec may give you some more hints [1]. Christian
[1] http://www.expath.org/spec/http-client
I am trying to set User-Agent header attribute for an HTTP request with following code snippet.
let $content := http:send-request(<http:request method='get' status-only='false' User-Agent='Mozilla/5.0'/>, $url) let $body := $content[2] return $body
But It is sending "Java/1.7.0_02" as User-Agent header attribute. This has been taken from wireshark:
GET / HTTP/1.1 User-Agent: Java/1.7.0_02 Host: istanbul.olx.com.tr Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Do we have any way to set the user-agent attribute?
Thanks
Erol Akarsu
Christian,
That is what I wanted and it worked!
I have another thing I need. I need to post a document to a http service that expects a xml document. To do this, I need to attach an xml document with http post request Do we have an example in basex:rrequest to make an http post with attachment?
Thanks
Erol Akarsu
On Wed, Oct 31, 2012 at 6:25 PM, Christian Grün cg@basex.org wrote:
This may work:
<http:header name="User-Agent" value="blub"/>
The spec may give you some more hints [1]. Christian
[1] http://www.expath.org/spec/http-client
I am trying to set User-Agent header attribute for an HTTP request with following code snippet.
let $content := http:send-request(<http:request method='get' status-only='false' User-Agent='Mozilla/5.0'/>, $url) let $body := $content[2] return $body
But It is sending "Java/1.7.0_02" as User-Agent header attribute. This
has
been taken from wireshark:
GET / HTTP/1.1 User-Agent: Java/1.7.0_02 Host: istanbul.olx.com.tr Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Do we have any way to set the user-agent attribute?
Thanks
Erol Akarsu
Once again, just have a look at the official page and search for the first occurrence of POST:
http://www.expath.org/modules/http-client/samples _____________________________
On Thu, Nov 1, 2012 at 9:33 AM, Erol Akarsu eakarsu@gmail.com wrote:
Christian,
That is what I wanted and it worked!
I have another thing I need. I need to post a document to a http service that expects a xml document. To do this, I need to attach an xml document with http post request Do we have an example in basex:rrequest to make an http post with attachment?
Thanks
Erol Akarsu
On Wed, Oct 31, 2012 at 6:25 PM, Christian Grün cg@basex.org wrote:
This may work:
<http:header name="User-Agent" value="blub"/>
The spec may give you some more hints [1]. Christian
[1] http://www.expath.org/spec/http-client
I am trying to set User-Agent header attribute for an HTTP request with following code snippet.
let $content := http:send-request(<http:request method='get' status-only='false' User-Agent='Mozilla/5.0'/>, $url) let $body := $content[2] return $body
But It is sending "Java/1.7.0_02" as User-Agent header attribute. This has been taken from wireshark:
GET / HTTP/1.1 User-Agent: Java/1.7.0_02 Host: istanbul.olx.com.tr Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Do we have any way to set the user-agent attribute?
Thanks
Erol Akarsu
basex-talk@mailman.uni-konstanz.de