简体   繁体   English

如何在php中设置curl?

[英]How to set up curl in php?

I am trying to use some SMS gateway and it require me to use curl to post a message to their server. 我正在尝试使用一些SMS网关,并且它要求我使用curl将消息发布到他们的服务器。

How do I set up curl on a windows and linux server? 如何在Windows和Linux服务器上设置curl?

I guess curl is some PHP library? 我猜curl是一些PHP库吗?

Which files do I need to include? 我需要包括哪些文件?

Where will I get those files? 我从哪里可以得到这些文件?

cURL can be used as a PHP module , but you can also install it as a regular command line application and execute curl commands as separate processes cURL可以用作PHP模块 ,但您也可以将其安装为常规命令行应用程序,并作为单独的进程执行curl命令

If you want to test your server support for either of these, try this: 如果要测试对这两种服务器的支持,请尝试以下操作:

<?php

//test for extension
if (extension_loaded("curl"))
{
    echo "cURL extension is loaded<br>";
}    
else
{
    echo "cURL extension is not available<br>";
}

//test for command line app
echo "cURL command line version:<br><pre>";
echo `curl --version`;
echo "</pre>";

?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM