gpt4 book ai didi

php - 如何使用 mockbin API 正确创建一个 bin?

转载 作者:可可西里 更新时间:2023-11-01 17:34:51 25 4
gpt4 key购买 nike

我正在尝试使用 mockbin API 创建一个垃圾桶.我试过 PHP/cUrl 、SoapUI 和 Postman,但我一直收到空响应正文:

要求:

POST /bin/create/view HTTP/1.1
Host: mockbin.org
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache

响应:

HTTP/1.1 200 OK
Date: Tue, 12 Jan 2016 13:21:50 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d183c7edefea549cc0bbe219ac11fe7c81452604909; expires=Wed, 11-Jan-17 13:21:49 GMT; path=/; domain=.mockbin.org; HttpOnly
Vary: X-HTTP-Method-Override, Accept, Accept-Encoding
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST
Access-Control-Allow-Headers: host,connection,accept-encoding,x-forwarded-for,cf-ray,x-forwarded-proto,cf-visitor,content-type,accept,user-agent,via,cf-connecting-ip,x-request-id,x-forwarded-port,connect-time,x-request-start,total-route-time,content-length
Access-Control-Allow-Credentials: true
Content-Encoding: gzip
Via: 1.1 vegur
Server: cloudflare-nginx
CF-RAY: 26392aae22092ac1-WAW

预期响应:

HTTP/1.1 200 OK
Location: http://mockbin.org/3c149e20-bc9c-4c68-8614-048e6023a108
Content-Type: application/json; charset=utf-8
Content-Length: 38

"3c149e20-bc9c-4c68-8614-048e6023a108"

其他 API 方法可以正常工作,即 echo .

最佳答案

mockbin API 文档中似乎有错误。我已经在本地安装了它,并在使用 html 表单创建 mockbin 时检查了发送的请求。似乎proper request is :

POST /bin/create HTTP/1.1
Host: mockbin.com
Accept: application/json
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

response=%7B%22status%22%3A200%2C%22statusText%22%3A%22OK%22%2C%22httpVersion%22%3A%22HTTP%2F1.1%22%2C%22headers%22%3A%5B%5D%2C%22cookies%22%3A%5B%5D%2C%22content%22%3A%7B%22mimeType%22%3A%22text%2Fplain%22%2C%22text%22%3A%22%22%7D%7D

关于php - 如何使用 mockbin API 正确创建一个 bin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34744930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com