PHP Tip: Call to undefined function curl_init_php Tutorial

Source: Internet
Author: User
I'm going to use the Curl function to collect data when I find that the call to undefined function Curl_init error, later learned from the official website because curl default is not PHP open function, we need to manually open Oh, Let me show you how to turn on the Curl function.

Cases

The code is as follows Copy Code

$ch = Curl_init (); Initialize Curl
curl_setopt ($ch, Curlopt_url, $url);//Set link
curl_setopt ($ch, Curlopt_returntransfer, 1);//Set whether to return information
curl_setopt ($ch, Curlopt_httpheader, $header);//Set HTTP header
curl_setopt ($ch, Curlopt_post, 1);//set to POST mode
curl_setopt ($ch, Curlopt_postfields, $xml _data);//post data
$response = curl_exec ($ch);//Receive return information
if (Curl_errno ($ch)) {//error message displayed
Print Curl_error ($ch);
}
Curl_close ($ch); Turn off Curl Links
echo $response;//Display return information

Results appear

Call to undefined function curl_init

Here's how to fix it:

1. Open the php.ini and turn on the Extension=php_curl.dll

2. Check php.ini extension_dir value is which directory, check if there is no php_curl.dll, do not download Php_curl.dll, and then copy the PHP directory Libeay32.dll,ssleay32.dll to C: Windowssystem32 inside

There's still a problem after the change.

In the httpd.conf file, add:

LoadFile the full path of the dynamic link library

For example, PHP needs to extend curl here, so the workaround is to add the following in the httpd.conf file:

LoadFile D:/php/libeay32.dll
LoadFile D:/php/ssleay32.dll

That will solve the problem.

http://www.bkjia.com/PHPjc/632116.html www.bkjia.com true http://www.bkjia.com/PHPjc/632116.html techarticle I'm going to use the Curl function to collect data when I find that the call to undefined function Curl_init error, later learned from the official website because curl default is not PHP open function, we need to hand ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.