Facebook uses curl to get user profiles

Source: Internet
Author: User

Use Facebook to get user information

$graph _url= "Https://graph.facebook.com/me?scope=email&fields=id,name,email,first_name,last_name,link, birthday,picture&access_token= $access _token "; $s = Curl_init (); curl_setopt ($s, curlopt_url, $url); curl_setopt ($ s,curlopt_returntransfer,1); curl_setopt ($s, curlopt_header, 0); $body = curl_exec ($s); curl_close ($s);

$body, always empty, but Var_dump (Curl_errno ($s)); no error number.

and directly to the $graph_url, put in the browser address bar, is able to obtain information

Went online to check the next, plus curl_setopt ($s, curlopt_ssl_verifypeer, 0);

CURLOPT_SSL_VERIFYHOSTThe value

    • Set to 0 indicate that the certificate is not checked
    • Set to 1 indicate whether a field is checked in the certificate CN(common name)
    • Set to 2 represent the 1 basis of the colonel's inspection当前的域名是否与CN匹配

libcurlthe previous version of this variable is the boolean value, for the true time effect is set to 2 , and later out 调试需求 , increased 仅校验是否有CN字段 options, so two values are true/false not enough, upgrade to 0/1/2 three values.

Later (later libcurl_7.28.1 versions), this debug option is removed because of this, so it is 经常被开发者用错 not supported at this 1 time, there are only 0/2 two kinds of values.

  

  

Facebook uses curl to get user profiles

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.