Using PHP's curl to get Sina's API data

Source: Internet
Author: User
I've stitched up Sina's API to get some data from Weibo. This is the link I have pieced together:
Https://api.weibo.com/2/statuses/repost_timeline.json?id=3681834027857481&page=1&count=100&access_ Token=2.00oa6w2chiarmb96820f87ebenjkee
If you enter this link directly in the browser, the roommate data, but: if I use the Crul function, but I do not get
Here is my function: (Note: That is the link above the line)
$ch = Curl_init ();
2. Set request options, including specific URLs
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_header, 0);
3. Perform a curl session and get related replies
$response = curl_exec ($ch);
4. Release the curl handle and close a curl session
Curl_close ($ch);
I print out the $response value is false, solve the big God


Reply to discussion (solution)

Plus
curl_setopt ($ch, Curlopt_ssl_verifypeer, 0);

Protocol Header HTTPS
Curl turns on certificate validation by default
So it should be closed.

Plus
curl_setopt ($ch, Curlopt_ssl_verifypeer, 0);

Protocol Header HTTPS
Curl turns on certificate validation by default
So it should be closed.
You can do it your way, thank you.

  • 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.