DotNetNuke,PHP,使用curl模拟远程回发 [英] DotNetNuke, PHP, Simulating a remote postback using curl

查看:183
本文介绍了DotNetNuke,PHP,使用curl模拟远程回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在DNN中有一个网页:
http://nolimitswebdesign.com.dnnmax.com/test/tabid/57/ctl/Edit/mid/374/Default.aspx

I have a page in DNN like: http://nolimitswebdesign.com.dnnmax.com/test/tabid/57/ctl/Edit/mid/374/Default.aspx

我需要使用PHP + Curl向该页面发送一个发布请求,修改文本区域的内容并保存它(就好像有人手动修改它并点击该页面上的更新按钮)。我怀疑用DNN它可能不可能。请指教。

I need to send a post request to that page using PHP+Curl which modifies the content of text area and saves it (like as if someone modified it manually and clicked the update button on that page). I doubt that with DNN it might not be possible. Please advise.

推荐答案

这里是我如何处理这个问题相同的一般技术将在任何网站上工作。在这方面,DNN只是一个平均的ASP.Net网站。首先看看点击更新时运行的javascript:

Here is how I would approach the problem the same general technique will work on any website. In this context DNN is just an average ASP.Net website. First look at the javascript that runs when update is clicked:

__doPostBack('dnn$ctr374$EditHTML$cmdUpdate','')

查找__doPostBack方法:

Find the __doPostBack method:

function __doPostBack(eventTarget, eventArgument) {
  if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
  }
}

这是标准的doPostBack ASP.Net表单。从中可以看出,您希望使用方法调用中的相应值填写__EVENTTARGET和__EVENTARGUEMENT隐藏字段,并提交表单。

This is the standard doPostBack() method used in many ASP.Net forms. From this you can see that you want to fill in the __EVENTTARGET and __EVENTARGUEMENT hidden fields with the appropriate values from the method call and submit the form.

当然,您还需要将实际要保存到数据中的数据保存到文本框的输入控件中。如果你使用HTML模块的基本文本框模式,那么你可能更容易做到这一点,那么你只需要设置一个textarea的值,而不是在fckEditor中插入值,而技术将如果站点配置为使用Telerik提供程序而不是fck提供程序,仍然可以工作。

Of course you also need to fill in the data you actually want to save into the input control for the text box. It will probably be easier to do this if you use the basic text box mode of the HTML module, then you just need to set the value of a textarea rather than figure out where to insert the value in the fckEditor, and the technique will be still work if the site is configured to use the Telerik provider instead of the fck provider.

有一点需要注意的是,控制名称可能会不时更改,因此您需要确保您正在读取事件目标的正确ids,而textarea不仅仅是硬编码的东西。

One thing to watch out for is that the control name may change from time to time, so you need to be sure you are reading the correct ids for the event target, and textarea not just hard coding something.

这篇关于DotNetNuke,PHP,使用curl模拟远程回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆