php curl_init function usage_PHP tutorial
Jul 13, 2016 am 10:52 AMphp curl_init function usage
First of all, I turned on the extension=php_curl.dll function in php.ini in Cwindows, and then restarted apapche. The following is what I wrote to capture the information of PHP in Baidu:
<?php
//Initialize curl
$ch = curl_init() or die (curl_error());
echo "Test it";
//Set URL parameters
curl_setopt($ch,CURLOPT_URL,"http://www.baidu.com/s?wd=php");
//Require CURL to return data
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
//Execute request
$result = curl_exec($ch) or die (curl_error());
//Get the returned result and display
echo $result;
echo curl_error($ch);
//Close CURL
curl_close($ch);
?>
But why didn't it respond? There is no test text. If I put echo "test"; on the first line, it can be output. I guess the curl_init() function has not been run yet!
Check if there is CURL extension support in PHP’s phpinfo()!
Copy php_curl.dll to c:windows and c:windowssystem32 and restart apache
Try it later
Copy libeay32.dll and ssleay32.dll in the php directory to c:windowssystem32 and restart apache

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated?

deepseek web version entrance deepseek official website entrance

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node?

How To Set Up Visual Studio Code (VS Code) for PHP Development

How do you parse and process HTML/XML in PHP?

Coinsuper exchange software channel official website entrance
