使用 curl,我可以使用 GET,但我不能使用 POST

问题描述

我总是在发送 GET 请求时收到成功代码 200。

root# curl -X GET http://<url>:7701 /services/S12002030 -vL
* About to connect() to <url> port 7701 (#0)
*   Trying <server's IP>...
* Connected to <url> (<server's IP>) port 7701 (#0)
> GET /services/S120020030 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: <url>:7701
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Lenght: 0
< 
* Connection #0 to host <url> left intact

但是我无法使用 POST 请求从服务器获得任何响应。

root# curl -X POST -d"data=123" http://<url>:7701 /services/S12002030 -vL
* About to connect() to <url> port 7701 (#0)
*   Trying <server's IP>...
* Connected to <url> (<server's IP>) port 7701 (#0)
> POST /services/S120020030 HTTP/1.1
> User-Agent: curl/7.29.0
> Host: <url>:7701
> Accept: */*
> Content-Lenght: 8
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 8 out of 8 bytes
* Empty reply from server
* Connection #0 to host <url> left intact
curl: (52) Empty reply from server

客户端和服务器不在同一个局域网内。当我使用“ping”或“telnet”时,它显示客户端和服务器可以通信。

我尝试使用另一个 LAN 上的客户端访问服务器。我至少可以获得一个状态代码一个 xml 消息。所以服务器应该启动并运行。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)