Home >Backend Development >PHP Tutorial >How to implement http and https requests using curl in php, phpcurlhttps request_PHP tutorial
The example in this article describes how curl in PHP implements http and https requests, and is shared with you for your reference. The details are as follows:
Generally speaking, PHP's curl function group can help us disguise machines as human behavior to crawl websites. Let's share two examples, one is to access http web pages, and the other is to access https web pages. Let's take a look.
Every time you want to use curl, you always have to check a lot of information.
Now save a few frequently used sentences to save you from having to Google them every time.
Regular curl request:
Attention
When requesting https data, a certificate will be required. At this time, add the following two parameters to avoid SSL certificate checking
I hope this article will be helpful to everyone’s PHP programming design.
The error message is that the https protocol cannot be supported.
stackoverflow.com/…-https saved me, thank God.
It says there is an extra space in front of https
Yes.
CURLOPT_PROTOCOLS
Bitfield refers to CURLPROTO_*. If enabled, the bitfield value limits which protocols libcurl can use during transfers. This will allow you to compile libcurl to support many protocols, but only to use a subset of them that are allowed to be used. By default libcurl will use all protocols it supports. See CURLOPT_REDIR_PROTOCOLS.
The available protocol options are: CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_FTP, CURLPROTO_FTPS, CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_TELNET, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO _TFTP, CURLPROTO_ALL
Yes, you can definitely get it Return value