假设我有
$_POST["x"]["y"] = 5;
我怎么能够
Yii::app()->request->getPost('x[y]');
我如何通过索引检索post变量?是否有任何yii函数检查sql注入?getPost会检查吗?
谢谢 .
我正在尝试修改使用Google Chrome开发人员工具捕获的卷曲请求.
这是命令的样子
curl "http://WEBSITE" -H "Host: WEBSITE" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "Content-Type: multipart/form-data; boundary=---------------------------1184875127259" --data-binary "-----------------------------1184875127259"^
"Content-Disposition: form-data; name=""FORM1"""^
"FORM1DATA"^
"-----------------------------1184875127259"^
"Content-Disposition: form-data; name=""FORM2"""^
"FORM2DATA"^
"-----------------------------1184875127259"^
"Content-Disposition: form-data; name=""FORM3"""^
"FORM3DATA"^
"-----------------------------1184875127259"^
"Content-Disposition: form-data; name=""embed"""^
"true"^
"---------------------------1184875127259--"^
""
Form#是表单的名称,Form#Data是我在表单中提交的数据.
我怎样才能将这个单线卷曲请求复制到我的命令行中并让它与我的浏览器做同样的事情?
如何从ColdFusion中的POST请求中获取值?
找出POST.id不起作用的艰难方式URL.id.
我正在尝试使用Python中的cookie进行HTTP POST.
我有URL,POST数据和cookie的值.
import urllib2
url="http://localhost/testing/posting.php"
data="subject=Alice-subject&addbbcode18=%23444444&addbbcode20=0&helpbox=Close+all+open+bbCode+tags&message=alice-body&poll_title=&add_poll_option_text=&poll_length=&mode=newtopic&sid=5b2e663a3d724cc873053e7ca0f59bd0&f=1&post=Submit"
cookie = "phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A1%3A%223%22%3B%7D; phpbb2mysql_t=a%3A9%3A%7Bi%3A3%3Bi%3A1330156986%3Bi%3A1%3Bi%3A1330160737%3Bi%3A5%3Bi%3A1330161702%3Bi%3A6%3Bi%3A1330179284%3Bi%3A2%3Bi%3A1330160743%3Bi%3A7%3Bi%3A1330163187%3Bi%3A8%3Bi%3A1330164442%3Bi%3A9%3Bi%3A1330164739%3Bi%3A10%3Bi%3A1330176335%3B%7D; phpbb2mysql_sid=5b2e663a3d724cc873053e7ca0f59bd0"
#creating HTTP Req
req = urllib2.Request(url,data,cookie)
f = urllib2.urlopen(req)
print f.read()
但是,如果我尝试运行该程序,则会抛出错误:
Traceback (most recent call last):
  File "task-4.py", line 7, in <module>
    req = urllib2.Request(url,data,cookie)
  File "/usr/lib/python2.6/urllib2.py", line 197, in __init__
    for key, value in headers.items():
AttributeError: 'str' object has no attribute 'items'
我有两个问题:1.我的HTTP POST请求是否正确?(我已经能够在Java中执行相同的操作并获得了一个成功发布到phpBB的HTTP 200,但是,我是Python的新手)2.有人可以向我展示一个使用POST数据处理HTTP POST的玩具示例饼干?
提前致谢,
罗伊
我正在玩Twitter API并注意到一些有趣的东西 - 对于更新,它们需要POST方法,但期望查询字符串中的参数.(在他们的开发者控制台的状态/更新调用例如见这里.)
显然这在技术上是可行的,但为什么有人这样做呢?POST参数是否属于正文?
我试图准确理解如何设置一个通常是私有的存储桶,但允许匿名上传有限制.具体标准是:
我的问题是:
到期时间似乎可以通过S3 Management Console设置,但最短到期时间限制为1天.我可以在该字段中输入小数吗?权限似乎适用于整个存储桶而不仅仅是前缀.这让我觉得我只需要两个水桶.如果我保留一个存储桶,我认为我需要创建一个IAM策略并将其应用到存储桶中,但这超出了我对S3的有限知识,我想确保我不会在允许人们做的权限中留下漏洞比我想要他们更多.
我已经找到很多关于通过HTTP表单帖子匿名上传到S3的文档.我可以将其改编成代码,但我想知道,因为我在应用程序代码(而不是HTTP表单帖子)是否有更简单的方法?
我似乎无法让它工作......我在客户端上有一些像这样的jQuery:
$.ajax({
    type: "POST",
    url: "api/report/reportexists/",
    data: JSON.stringify({ "report":reportpath }),
    success: function(exists) {
        if (exists) {
            fileExists = true;
        } else {
            fileExists = false;
        }
    }
});
在我的Web.API控制器中,我有一个这样的方法:
[HttpPost]
public bool ReportExists( [FromBody]string report )
{
    bool exists = File.Exists(report);
    return exists;
}
我只是检查一个文件是否存在于服务器上,并返回一个bool是否存在.我发送的报告字符串是UNC路径,因此reportpath看起来像'\\ some\path \'.
我可以解决脚本问题,并在ReportExists方法中点击断点,但报表变量始终为null.
我究竟做错了什么?
我也看到了使用.post和postJSON发布的方法.也许我应该使用其中之一?如果是这样,我的格式是什么?
更新: 一个额外的线索可能 - 如果我删除[FromBody]然后我的断点根本没有被击中 - '没有找到匹配请求的http资源'.我看的例子表明不需要[FromBody] ......?
我有一个问题,当我发布到控制器时,我失去了绑定,我的视图模型中的所有内容都是NULL.这是我正在使用的代码:
视图:
@model ArticleCategoryVm
@using (@Html.BeginForm())
{
    @Html.HiddenFor(model => model.LanguageIdDisplayed)
    <label>Name: <span class="label label-important">Required</span></label>
    @Html.HmlValidationFor(model => model.CategoryName)
    @Html.TextBoxFor(model => model.CategoryName, new { maxlength = "255", placeholder = "Category Name", @class = "input-xlarge-fluid" })                  
    <span class="help-block">The is the name of the category and how it appears on the site.</span>
    <label>Language: <span class="label label-important">Required</span></label>
    @Html.HmlValidationFor(model => model.LanguageId)
    @Html.DropDownList("LanguageId", new SelectList(@Model.Languages, "Value", "Text"), "Select language", new { @class="input-xlarge-fluid" })
    <span class="help-block">This will be the language that the category is set too.</span>
    <label>Parent:</label>
    @Html.HmlValidationFor(model …我正在将数据发送到带有Arduino的服务器,这需要逐行构建HTML POST.我不一定知道Content-Length a-priori,所以我使用"chunked"编码.
当我尝试使用rfc2616中指定的"Transfer-Encoding"选项从Wikipedia发布此示例帖子时
client.println("POST /myurl HTTP/1.1");
client.println("Host: 12.345.679.999"); // replaced with the test server's IP
client.println("User-Agent: Arduino/1.0");
client.println("Transfer-Encoding: chunked");
client.println();  
client.println("4");
client.println("test");
client.println("0");
client.println();
或者,使用转义字符显式:
client.print("4\r\ntest\r\n0\r\n\r\n");
我从服务器收到错误:
HTTP/1.1 411 Length Required
A request of the requested method POST requires a valid Content-length.
Server: Apache/2.2.22 (Ubuntu)
但是,"chunked"编码不应该要求Content-Length头字段,请参阅rfc2616中的4.4 - 消息长度
我错过了一个领域吗?为什么这个电话不起作用?
为了记录,非Chunked-Encoding工作:
if(client.connect(server, 80)){
    String PostData = "test";
    Serial.println("POST /myurl HTTP/1.1");
    client.println("Host: 12.345.679.999"); // replaced with the test server's IP
    Serial.println("User-Agent: Arduino/1.0"); …我需要将数据发布到Webview.
我从以下代码中找到了一些链接:
 WebView webview = new WebView(this);
 setContentView(webview);
 String url = "http://www.example.com";
 String postData = username=my_username&password=my_password";
 webview.postUrl(url",EncodingUtils.getBytes(postData, "BASE64"));
但是在我的android工作室中我看到EncodingUtils已被弃用
任何人都可以帮我解决EncodingUtils将数据发布到Android WebView的替代方案吗?