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条)

报告相同问题?