【问题标题】:How to convert a wget request to a http request如何将 wget 请求转换为 http 请求
【发布时间】:2012-01-12 06:12:24
【问题描述】:

我用:

wget --no-check-certificate --http-user=user --http-password=secret --header="Content-Type:text/xml" --post-file=request.xml https://mydominain.com/xml

发送一个xml请求。

xml 文件 (request.xml) 是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<request method="switchvox.call">
<parameters>
<dial_first>1111</dial_first>
<dial_second>2222</dial_second>
<dial_as_account_id>1127</dial_as_account_id>
<caller_id_name>John Doe</caller_id_name>
</parameters>
</request>

在编写程序之前,我需要测试一些 xml 请求。

是否可以使用浏览器发送相同的请求? 是否可以在浏览器中使用复制粘贴来测试请求? 是否可以在浏览器请求中发送 xml 文件?

【问题讨论】:

    标签: xml xmlhttprequest


    【解决方案1】:

    是否可以使用浏览器发送相同的请求?

    由于您在请求中使用非标准(用于浏览器表单)内容类型:仅通过使用带有 XMLHttpRequest 的 JavaScript。

    是否可以在浏览器中使用复制粘贴来测试请求?

    不……你可以编写脚本,然后将其复制并粘贴到 JS 控制台中。

    是否可以在浏览器请求中发送 xml 文件?

    鉴于上述附带条件,是的,但它似乎比您现有的解决方案更麻烦。

    【讨论】:

      【解决方案2】:

      我不知道使用浏览器,但您可以使用 Fiddler 创建包含您喜欢的任何内容的原始 http 请求。

      如果您想/需要重新创建它们,您还可以在浏览网站时捕获 http 请求。

      http://www.fiddler2.com/fiddler2/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多