我一直试图让一个小的PHP脚本登录到DOTNETNUKE应用程序几天,但没有用。我在使用firefox的Tamper Data插件发送它们时,已经复制了标题和发布变量。
每次我发送数据时都会收到以下错误:
误差=您%20session%20has%20expired。%20%20Please%20try%20again
据我所知,这是因为DOTNETNUKE Cookie没有被传回,我不确定为什么会有任何帮助。我的GUZZLE代码如下:
include_once(LIBRARY_PATH . '/guzzle.phar');
use Guzzle\Http\Client;
use Guzzle\Plugin\Cookie\CookiePlugin;
use Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar;
$cookiePlugin = new CookiePlugin(new ArrayCookieJar());
$client = new Client('ASPX URL CODE GOES HERE');
$client->addSubscriber($cookiePlugin);
$client->setUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0');
$response = $client->get('ASPX URL CODE GOES HERE')->send();
$request = $client->post('ASPX URL CODE GOES HERE', array(), array(
'__EVENTTARGET' => 'dnn$ctr383$LoginPage$SearchPage$dataPanel$ctl01$ctl13$LoginButton',
'__EVENTARGUMENT' => '',
'dnn$ReturnModuleFocus' => '',
'dnn$ModuleFocalPoint' => '',
'dnn$ModuleInvokedFromDataSearch' => '',
'dnn$ctr383$LoginPage$SearchPage$dataPanel$ctl01$ctl11$userName$mb_userName' => 'USERNAME HERE',
'dnn$ctr383$LoginPage$SearchPage$dataPanel$ctl01$ctl12$password$mb_password' => 'PASSWORD HERE',
'dnn$ctr383$LoginPage$SearchPage$dataPanel$ConfirmationSaveResponse' => '',
'dnn$ctr383$LoginPage$SearchPage$dataPanel$MinMax' => '',
'dnn$ctr383$LoginPage$SearchPage$dataPanel$dpPostBack' => '',
'ScrollTop' => '',
'__dnnVariable' => '',
'ScrollX' => '0',
'ScrollY' => '0',
'iCWindowID' => '2',
'iCRequestID' => '1',
'iCFieldsChanged' => '0',
'__VIEWSTATE' => ''
));
$response = $request->send();
echo $response;
提前致谢!
答案 0 :(得分:0)
通过查看您的代码,您似乎正在处理asp网站。我对ASP不好,但我正在抓取很多用它构建的网站,你的问题是__VIEWSTATE参数。
ASP正在使用此随机字符串进行某种奇怪的会话处理。您可以通过下载登录表单页面并解析出__VIEWSTATE隐藏输入字段的值来轻松解决该问题