Php curl to obtain https encryption protocol requests return json data for information retrieval
Source: Internet
Author: User
Php curl to obtain https encryption protocol requests return json data for information retrieval Header ("Content-type: text/html; charset = utf-8 ");
Function getToken ($ url ){
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); // It is critical that the results returned by curl_exec ($ ch) can be assigned to other variables, json data operation. if this statement is not provided, the data returned by curl cannot be operated manually (such as json_decode)
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
Return curl_exec ($ ch );
// $ Row = curl_getinfo ($ ch, CURLINFO_HTTP_CODE );
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.