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

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

问题描述

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

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...

我真的不需要所有的脚本,因为我想我可以弄明白,但我想知道我如何制作第一部分,将网页连接到 s1.com 网页,以便无法获取数据?

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?

感谢大家的帮助!

推荐答案

你可以使用 curl (链接有一个例子)或 fopen(参见示例部分).

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

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

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天全站免登陆