duannengling4705 2012-04-07 23:33
浏览 41
已采纳

通过身份验证从外部网站提取内容。

I'm currently trying to create a php script were the user has the ability to connect their user to several pages.

That was the idea.

What i'm trying to to is to check if the user is logged in to battlelog, and then grab his username.

I'm not sure if it's even possible... But i would appreciate any help I can get!

  • 写回答

2条回答 默认 最新

  • duandingyou3331 2012-04-07 23:38
    关注

    The main problem you're going to run into here is that most modern browsers employ cross-domain security to make sure that other websites or potentially malicious websites cannot gain illegal access to the user data in another browser window.

    What you're hoping to accomplish is what's called cross-site scripting. It is possible under certain circumstances. For instance, if battlelog exposes an API for another developer to access user data.

    This would of course involve server-side requests cross-domain, so you'd either need to use your server as a proxy, or use a JSONP web service where the response is sent in JSON format wrapped in a callback function.

    Accessing Data From PHP Scripts:

    Since you're using PHP, you'd need to have access to an API. PHP scripts cannot make requests to a browser, so battlelog would either need to have a plug-in architecture where you can embed scripts in their website, or they would need to expose an API for you to query from your server.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站