在此curl post命令中使用字符串而不是文件

在此curl post命令中使用字符串而不是文件,curl,Curl,此请求在我的Linux上运行良好: curl -F out=json -F "content=<FILE.html" http://validator.w3.org/nu/ curl-F out=json-F”content=您可以使用而不是-F使字符串成为文字(即不解析小于号),只需用单引号将字符串引起来,使bang对shell失去意义 curl -F out=json \ --form-string 'content=<!DOCTYPE html><html&

此请求在我的Linux上运行良好:

curl -F out=json -F "content=<FILE.html" http://validator.w3.org/nu/
curl-F out=json-F”content=您可以使用而不是-F使字符串成为文字(即不解析小于号),只需用单引号将字符串引起来,使bang对shell失去意义

curl -F out=json \
   --form-string 'content=<!DOCTYPE html><html><head><title></title></head><body></body></html>' \
   http://validator.w3.org/nu/
curl-F out=json\
--表单字符串“content=”\
http://validator.w3.org/nu/

这可能与您在哪个操作系统上执行此操作有关
<!DOCTYPE html><html><head><title></title></head><body></body></html>
curl -F out=json \
   --form-string 'content=<!DOCTYPE html><html><head><title></title></head><body></body></html>' \
   http://validator.w3.org/nu/