doulangbi6869 2015-04-03 18:09
浏览 42
已采纳

如何在共享身份验证的同时将一个网站集成到另一个网站?

I manage a website. Let's name it Website A. Website A is written in PHP, procedural-style, with a few different and out-dated frameworks in it. No surprise, it is a mess to maintain and to upgrade. I want to create Website B with a clean framework (Symfony2) and using OOP. Slowly I will refactor Website A into Website B. Any new features will also be done in Website B.

The catch? I want content from Website A to appear in the layout of Website B. I can't simply include the files of Website A in Website B as the configuration of it messes with the framework of Website B. What's the best way to achieve it? Using an iframe? Using Curl? Or using another method?

When I tried using AJAX, the integration went smoothly. Since they're on the same domain the cookies are shared, so even if the user logs in on Website B, Website A is aware of it. It was, however, slow to output and I had problems with the responsive design (even though I know responsive iframe can be done).

When using Curl, it was much faster to output and no responsive problems. However, since it's PHP that connects to Website A, I need to find a way to pass the authentication from one Website to another.

Both methods need some work in order to function properly. I lean toward the curl method, but is there a "best practice" in my case?

Both websites has personalized content, it's not simply a firewall-type authentification.

  • 写回答

1条回答 默认 最新

  • douduoyan5943 2015-04-03 18:25
    关注

    I'm not sure whether you're authentication involves personalised content, which would be harder, or just firewalled content. This would make a difference. The best approach I've seen to this problem was to use nginx as a reverse proxy.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)