使用PHP连接到外部网站

编程入门 行业动态 更新时间:2024-10-12 12:29:52
本文介绍了使用PHP连接到外部网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

解决方案

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

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

Let say i have a website (called s1..?) 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, 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 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连接到外部网站

本文发布于:2023-11-23 13:03:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621542.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   网站   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!