Discussion on the problem of curl opening in PHP

Source: Internet
Author: User
Tags configuration php curl ini phpinfo

  Sina provided in the PHP SDK needs to use the Curl_init () function, in the debugging time to find the Curl_init (), the following for you to open the curl steps

Today in doing a Sina login function, Sina provides the PHP SDK needs to use the Curl_init () function, in the debugging time can not find the Curl_init () method.   Search to find the need to open curl PHP expansion, then what is curl? What can I do?   Brief Introduction, when we need to grasp the data of a website, you can use the file (), file_get_contents (), such as Web page reading function, because too much of the thief program flooded, causing some sites to do the domain name restrictions, Instead, these file () functions are inefficient or even ineffective.   If the use of curl to optimize the words can be a number of forms, cookies, validation and other functions of the powerful, flexible effect.     Open Curl steps     1. At the localhost site, export the Phpinfo to detect PHP.ini's location in   (because when I open the curl, is in the PHP installation directory configuration php.ini, the result has not been effective, and later checked phpinfo just know php.ini in apache  configuration file was I redirected)   2. Open php.ini file and search Php_ Curl.dll, locate and remove the front ";", reboot apache  3. If the test is still unable to find Curl_init (), the PHP directory in the ext directory of PHP_ Curl.dll, and the PHP directory under the libeay32.dll,php5ts.dll,ssleay32.dll  copy to C:windowssystem32, reboot apache  Verify that the curl extension is open, Can be found in phpinfo ()   can also use program validation     code as follows://1. Initialization   $ch = Curl_init (); //2. Set options, including url  curl_setopt ($ch, Curlopt_url, "http://www.tupc1028.com");  curl_setopt ($ch, Curlopt_ Returntransfer, 1);  curl_setopt ($ch, Curlopt_header, 0); //3. Executes and obtains HTML document content   $output = curl_exec ($ch); &nBsp 4. Release Curl handle   curl_close ($ch);  $output = curl_exec ($ch);  if ($output = = FALSE) {  echo "Curl Error:". Curl_error ($ch); }     

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.