Leancloud's Restapi through PHP curl Access no results

Source: Internet
Author: User
According to Leancloud's official documentation, when using curl in PHP to access Restapi, it has been unable to complete the corresponding functions, such as the official document example to create a Gamescore object, PHP code as follows, set the access URL and AppID and other related parameters, When the execution of the last only return a 0, nothing else, Leancloud console can not see the creation of the object, the console originally created manually gamescore this class

php$headers = Array (' Content-type:application/json ', ' X-avoscloud-application-id: '. $    AppID, ' X-avoscloud-application-key: '. $appKey);                            $dataJson = Json_encode (Array (' score ' = 2015,                        ' PlayerName ' and ' Tom raidol ', ' cheatmode ' = True)    );    $curlConn = Curl_init ();    curl_setopt ($curlConn, Curlopt_timeout, 30);    curl_setopt ($curlConn, curlopt_useragent, ' avoscloud.com-php-library/2.0 ');    curl_setopt ($curlConn, Curlopt_returntransfer, true);    curl_setopt ($curlConn, Curlinfo_header_out, true);    curl_setopt ($curlConn, Curlopt_httpheader, $headers);    curl_setopt ($curlConn, Curlopt_customrequest, "POST");    curl_setopt ($curlConn, Curlopt_postfields, $dataJson);    curl_setopt ($curlConn, Curlopt_url, $leancloudAPI); $response = curl_exec ($cUrlconn);    Print_r ($response);    $responseCode = Curl_getinfo ($curlConn, Curlinfo_http_code); Echo $responseCode;

Reply content:

According to Leancloud's official documentation, when using curl in PHP to access Restapi, it has been unable to complete the corresponding functions, such as the official document example to create a Gamescore object, PHP code as follows, set the access URL and AppID and other related parameters, When the execution of the last only return a 0, nothing else, Leancloud console can not see the creation of the object, the console originally created manually gamescore this class

php$headers = Array (' Content-type:application/json ', ' X-avoscloud-application-id: '. $    AppID, ' X-avoscloud-application-key: '. $appKey);                            $dataJson = Json_encode (Array (' score ' = 2015,                        ' PlayerName ' and ' Tom raidol ', ' cheatmode ' = True)    );    $curlConn = Curl_init ();    curl_setopt ($curlConn, Curlopt_timeout, 30);    curl_setopt ($curlConn, curlopt_useragent, ' avoscloud.com-php-library/2.0 ');    curl_setopt ($curlConn, Curlopt_returntransfer, true);    curl_setopt ($curlConn, Curlinfo_header_out, true);    curl_setopt ($curlConn, Curlopt_httpheader, $headers);    curl_setopt ($curlConn, Curlopt_customrequest, "POST");    curl_setopt ($curlConn, Curlopt_postfields, $dataJson);    curl_setopt ($curlConn, Curlopt_url, $leancloudAPI); $response = curl_exec ($cUrlconn);    Print_r ($response);    $responseCode = Curl_getinfo ($curlConn, Curlinfo_http_code); Echo $responseCode;

Pit Daddy's SSL

How can i solve the problem?

Leancloud has released the official PHP-SDK:HTTPS://GITHUB.COM/LEANCLOUD/PHP-SDK, which has a good package for REST API, which is recommended for reference.

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