我想在ColdFusion中创建功能,让我登录到EA体育Web应用程序,所以我可以取回我的个人资料数据和我的网站上显示。登录使用CFHTTP
看着他们的登录页面的第一步只是似乎是一个简单的登录表单的源代码:
<form method="post" id="login_form" action="https://www.ea.com/uk/football/services/authenticate/login" class="login_form" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="redirectUrl" value="http://www.ea.com/uk/football/fifa-ultimate-team" />
<input type="hidden" name="failureUrl" value="http://www.ea.com/uk/football/login?failed=true&redirectUrl=http%3A%2F%2Fwww.ea.com%2Fuk%2Ffootball%2Ffifa-ultimate-team" />
<input type="hidden" name="captchaFailureUrl" value="http://www.ea.com/uk/football/login?failed=true&redirectUrl=http%3A%2F%2Fwww.ea.com%2Fuk%2Ffootball%2Ffifa-ultimate-team" />
<input id="email" name="email" class="text" type="text" tabindex="1" />
<input id="password" name="password" class="text" type="password" tabindex="2" />
<input type="checkbox" id="stay-signed" name="stay-signed" value="ON" checked="checked" tabindex="3" />
</form>
我使用CFHTTP请求提交以下材料:
<cfhttp url="https://www.ea.com/uk/football/services/authenticate/login" method="POST" result="myResult">
<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" />
<cfhttpparam type="formField" name="email" value="#Variables.user#" />
<cfhttpparam type="formField" name="password" value="#Variables.password#" />
</cfhttp>
当我倾倒所返回的东西,在fileContent包含以下内容: <authenticate><success>0</success></authenticate>
这我假设表示登录尚未成功。
我知道我不会给你太多的在这里玩,但似乎没有成为一个伟大的交易更以试图获得登录认证。任何人都可以指出我可能会出错的地方吗?
3件事情在我身上跳出来。我不知道这是“答案”,所以我只是评论。 1,你不包括所有的表单域。仅仅因为你不需要它们并不意味着它们不会被处理程序需要,反过来会导致错误。 2,这看起来并不像一个真正的API,因此它可能是EA是想看看是否提交表单的实际形式,所以你可能不能够远程提交。最后,对于CFHTTP默认的用户代理是“COLDFUSION”,你可能会想改变这种状况,以更有效的浏览器的名字,我已经是阻止我几次。 – Travis
这是您正在倾销的myResult变量吗? –
这只是myResult。fileContent变量我正在转储,但现在当我添加其他表单字段时,它会从fileContent变量中将它们的内容带回来,所以我假定登录失败并进入failureURL页面? – CPB07