在网站上显示登录内容 [英] Displaying Logged in Content on a Website

查看:108
本文介绍了在网站上显示登录内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不太确定如何用语言来描述它,而又不会使其变得过于复杂,所以这基本上就是我想要发生的事情:

I'm not quite sure how to describe this in words without making it overly complex, so here is basically what I want to happen:

  1. 用户访问了我的网站,例如:www.example.com/
  2. 服务器转到另一个网站example2.com,该网站上有一个用户应在其中输入用户名和密码的字段
  3. 服务器自动输入用户名和密码,然后重定向到站点的用户部分".
  4. 服务器单击侧栏上的链接之一,然后发送到另一页面用户部分".
  5. 然后,该网站抓取此页面上的所有内容,并将其显示在example.com上

我尝试执行此操作的原因是从具有用户名和密码部分的网站上创建RSS提要,而用户必须在其中登录.我没有见过RSS创建网站,您可以通过该网站来执行此操作,这就是为什么我试图以这种方式完成它的原因.但是,如果任何人都知道一个RSS网站可以使您做到这一点,那也很棒.

The reason I am attempting to do this is to create an RSS feed out of a website that has a username and password part where the user has to log in. I have not seen a RSS creating website that enables you to do this, which is why I am trying to accomplish it this way. However, if anyone knows of a RSS website that will enable you to do this, that would also be great.

感谢您的帮助!

推荐答案

听起来您可能正在寻找cURL和cookiejar:

It sounds like you might be looking for cURL and cookiejar:

http://curl.haxx.se/libcurl/php/examples/cookiejar.html

这将允许您以编程方式登录到站点,保持会话打开,然后访问受登录保护的内容.获取页面内容后,即可使用DomDocument( http://us2 .php.net/manual/en/domdocument.loadhtml.php )以访问所需的内容并将其转换为RSS数据.

This will allow you to programmatically login to a site, keep a session open, and then access the login protected content. Once you get the page contents, then you can use DomDocument (http://us2.php.net/manual/en/domdocument.loadhtml.php) to access the content you need and turn it into RSS data.

如果网站像许多人一样使用表单密钥,则将需要额外的工作才能从登录页面提取表单密钥并将其添加到登录POST

if the website uses form keys, like many do, this will require extra work to extract the form key from the login page and add it to the login POST

这篇关于在网站上显示登录内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆