Home Backend Development PHP Tutorial php curl_init function usage_PHP tutorial

php curl_init function usage_PHP tutorial

Jul 13, 2016 am 10:52 AM
curl php windows function exist usage first

php 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

It is not the file php_curl.dll
Copy libeay32.dll and ssleay32.dll in the php directory to c:windowssystem32 and restart apache

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632492.htmlTechArticlephp curl_init function usage First, in php.ini in Cwindows, I turned on the extension=php_curl.dll function , and then restarted apapche. The following is the information I wrote to capture PHP in Baidu...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

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? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

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 deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

deepseek web version entrance deepseek official website entrance

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

How to install deepseek

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

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 To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

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

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

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

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

Coinsuper exchange software channel official website entrance

See all articles