Connect to an external website with PHP(使用 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 连接到外部网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 PHP 连接到外部网站
基础教程推荐
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
