我需要一个实时测试服务器,它通过HTTP GET接受我对基本信息的请求,并允许我POST(即使它真的什么都不做)。这完全是为了测试目的。

这里有一个很好的例子。它很容易接受GET请求,但我需要一个接受POST请求以及。

有人知道我也可以发送虚拟测试消息的服务器吗?


当前回答

下面是一个邮差回声:https://docs.postman-echo.com/

例子:

curl --request POST \
  --url https://postman-echo.com/post \
  --data 'This is expected to be sent back as part of response body.'

回应:

{"args":{},"data":"","files":{},"form":{"This is expected to be sent back as part of response body.":""},"headers":{"host":"postman-echo.com","content-length":"58","accept":"*/*","content-type":"application/x-www-form-urlencoded","user-agent":"curl/7.54.0","x-forwarded-port":"443","x-forwarded-proto":"https"},"json":{"...

其他回答

https://httpbin.org/

它将在请求中使用以下类型的任何数据进行回显:

https://httpbin.org/anything Returns most of the below. https://httpbin.org/ip Returns Origin IP. https://httpbin.org/user-agent Returns user-agent. https://httpbin.org/headers Returns header dict. https://httpbin.org/get Returns GET data. https://httpbin.org/post Returns POST data. https://httpbin.org/put Returns PUT data. https://httpbin.org/delete Returns DELETE data https://httpbin.org/gzip Returns gzip-encoded data. https://httpbin.org/status/:code Returns given HTTP Status code. https://httpbin.org/response-headers?key=val Returns given response headers. https://httpbin.org/redirect/:n 302 Redirects n times. https://httpbin.org/relative-redirect/:n 302 Relative redirects n times. https://httpbin.org/cookies Returns cookie data. https://httpbin.org/cookies/set/:name/:value Sets a simple cookie. https://httpbin.org/basic-auth/:user/:passwd Challenges HTTPBasic Auth. https://httpbin.org/hidden-basic-auth/:user/:passwd 404'd BasicAuth. https://httpbin.org/digest-auth/:qop/:user/:passwd Challenges HTTP Digest Auth. https://httpbin.org/stream/:n Streams n–100 lines. https://httpbin.org/delay/:n Delays responding for n–10 seconds.

创建选择一个免费的网络主机,并把以下代码

<h1>Request Headers</h1>
<?php
$headers = apache_request_headers();
     
foreach ($headers as $header => $value) {
    echo "<b>$header:</b> $value <br />\n";
}
?>

我一直在使用这个REST API: https://restful-api.dev

它无限期地存储所创建的对象。 此外,该模式非常灵活,您可以传递任何JSON数据。

我是一个前端开发人员,当我需要创建一些示例数据时,这是非常有用的。这是我能找到的唯一一家不需要注册或代币就能免费使用的。

看看PutsReq,它与其他类似,但它也允许您使用JavaScript编写您想要的响应。

一些在线httpbin:

https://httpbin.org/ https://httpbingo.org/ https://quic.aiortc.org/httpbin/

获取客户端ip,端口,ua..

http://ifconfig.io/

获取客户端ip, isp

https://www.cip.cc/