|
|
 Ho | 2012-05-15 23:05:16 |
Hello sir,
I need to post some JSON data to a link linke "http://.../filename.aspx/method
It seems no JSON header defined in class.
Would I request to add this feature?
Thanks for your great class |
| |
2. Re: POST JSON data |
|
Reply |
|
|
 Manuel Lemos | 2012-05-15 23:57:15 - In reply to message 1 from Ho |
| The class allows you to send POST requests with any headers or body data. What exactly is the format of the data you want to send? Is it form URL encoded or raw JSON? |
| |
3. Re: POST JSON data |
|
Reply |
|
|
 Ho | 2012-05-16 05:40:02 - In reply to message 2 from Manuel Lemos |
There is Tamper Data of Request Headers and Values sent to server with browser:
=================
Host=www.domain.net
User-Agent=Mozilla/5.0 ....
Accept=application/json, text/javascript, */*; q=0.01
Accept-Language=en-us,en;q=0.5
Accept-Encoding=gzip, deflate
Connection=keep-alive
Content-Type=application/json; charset=utf-8
X-Requested-With=XMLHttpRequest
Referer=http://www.domain.net/remotescript.aspx
Content-Length=15
Cookie=ASP.NET_SessionId=xxxxxxxxxxxxxxxxxxxxxxx
Pragma=no-cache
Cache-Control=no-cache
POSTDATA={"name":"value"}
==================
I tried to modify $http but no success:
===========
http_class Object
(
...
[request_method] => POST
[user_agent] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
[authentication_mechanism] =>
[user] =>
[password] =>
[realm] =>
[workstation] =>
[proxy_authentication_mechanism] =>
...
[request_uri] => /remotescript.aspx/method
[request] => POST /remotescript.aspx/method HTTP/1.1
[request_headers] => Array
(
[Host] => www.domain.net
[User-Agent] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
[Pragma] => no-cache
[Accept] => application/json, text/javascript, */*; q=0.01
[Cache-Control] => no-cache
[Content-Type] => application/x-www-form-urlencoded
[X-Requested-With] => XMLHttpRequest
[Content-Length] => 15
)
...
[request_body] => %7B%22name%22%3A%22value%22%7D=
[request_arguments] => Array
(
[Protocol] => http
[HostName] => www.domain.net
[Headers] => Array
(
[Host] => www.domain.net
[User-Agent] => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
[Pragma] => no-cache
[Accept] => application/json, text/javascript, */*; q=0.01
[Cache-Control] => no-cache
[Content-Type] => application/json; charset=utf-8
[X-Requested-With] => XMLHttpRequest
)
[HostPort] => 0
[RequestURI] => /remotescript.aspx/method
[Referer] => http://www.domain.net/remotescript.aspx
[RequestMethod] => POST
[PostValues] => Array
(
[{"name":"value"}] =>
)
)
) |
| |
4. Re: POST JSON data |
|
Reply |
|
|
 Manuel Lemos | 2012-05-16 07:47:03 - In reply to message 3 from Ho |
You should not use PostValues. That is for submitting form data.
Use the Body argument to pass the request data. Take a look at the test_http_soap.php script for an example. |
| |
5. Re: POST JSON data |
|
Reply |
|
|
 Ho | 2012-05-17 09:05:25 - In reply to message 4 from Manuel Lemos |
Thank you for great CLASS and help!!
It solved my problem,
Thanks again |
|