PHP中的cURL是什么? [英] What is cURL in PHP?

查看:28
本文介绍了PHP中的cURL是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 PHP 中,我在许多 PHP 项目中看到 cURL 一词.它是什么?它是如何工作的?

In PHP, I see the word cURL in many PHP projects. What is it? How does it work?

参考链接:cURL

推荐答案

cURL 是一个库,可以让您制作PHP 中的 HTTP 请求.您需要了解的有关它(以及大多数其他扩展)的所有信息都可以在 PHP 手册中找到.

cURL is a library that lets you make HTTP requests in PHP. Everything you need to know about it (and most other extensions) can be found in the PHP manual.

为了使用PHP的cURL函数您需要安装 » libcurl包裹.PHP 要求您使用libcurl 7.0.2-beta 或更高版本.在 PHP 中4.2.3,您将需要 libcurl 7.9.0 或更高版本.从 PHP 4.3.0 开始,您将需要一个 libcurl 版本7.9.8 或更高版本.PHP 5.0.0 需要 libcurl 7.10.5 或更高版本.

In order to use PHP's cURL functions you need to install the » libcurl package. PHP requires that you use libcurl 7.0.2-beta or higher. In PHP 4.2.3, you will need libcurl version 7.9.0 or higher. From PHP 4.3.0, you will need a libcurl version that's 7.9.8 or higher. PHP 5.0.0 requires a libcurl version 7.10.5 or greater.

您也可以在没有 cURL 的情况下发出 HTTP 请求,但它需要在您的 php.ini 文件中启用 allow_url_fopen.

You can make HTTP requests without cURL, too, though it requires allow_url_fopen to be enabled in your php.ini file.

// Make a HTTP GET request and print it (requires allow_url_fopen to be enabled)
print file_get_contents('http://www.example.com/');

这篇关于PHP中的cURL是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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