使用PHP连接到外部网站 [英] Connect to an external website with PHP

查看:99
本文介绍了使用PHP连接到外部网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个带有登录表单的网站(称为s1.com ..?).成功登录网站后,您会看到一个页面,其中包含一些状态信息,例如:Ticket Closed.自从... 然后,ai在需要访问s1.com的另一台服务器上有一个页面,登录我,然后在票证关闭的情况下获取日期...

我真的不需要所有脚本,因为我认为我可以弄清楚它,但是我不知道如何制作第一部分,将网页连接到s1.com网页上,从而无法获取数据?

感谢任何帮助人员!

解决方案

您可以使用卷曲(链接有一个例子)或 fopen (请参阅示例部分).

请注意,使用fopen要求 allow_url_fopen 设置启用,而curl要求启用curl模块.

Let say i have a website (called s1.com..?) with a login form. After you succesfully log on the website, you have a page with some status infos like : Ticket Closed. since... And then ai have a page, on another server that need to go on s1.com, log me in and then retreive the date if the ticket is closed...

I dont really need all of the script since i think i can figure it out, but i wonder how do i make the first part, connecting the webpage onto the s1.com webpage so ill be able to fetch data?

Thanks for any help guys!

解决方案

You can use either curl (link has an example) or fopen (see the examples section).

Note that using fopen requires that the allow_url_fopen setting to be enabled, while curl requires the curl module to be enabled.

这篇关于使用PHP连接到外部网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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