Why does it not call https rest API using curl in php?

I am trying to make an API call with this code:

quote->author.'
'; echo $json_objekat->quote->body.'
'; ?>

This code is saved as a php file in www (root) folder on my local machine. I use a WAMP server.

When I open this file from WAMP it says:

Notice:  Trying to get property of non-object in C:wampwwwIzdavackaKucajavniServis.php on line 10 Trying to get property of non-object in C:wampwwwIzdavackaKucajavniServis.php on line 10 Trying to get property of non-object in C:wampwwwIzdavackaKucajavniServis.php on line 11 Trying to get property of non-object in C:wampwwwIzdavackaKucajavniServis.php on line 11

I checked php extensions option php_curl on WAMP and I don’t know if I should check some other options. I don’t know if there is some problem with my WAMP server or what the problem is, because I have sent this same code to a couple of other people and they say that it works on their computer. I don’t know where the error is so I hope someone can help me.

Thank you!

Unless you really otherwise do; i imagine that you may not have a Problem with your WAMP Server. The Problem i found is that the URL https://favqs.com/api/qotd.json has an Unknown SSL Protocol according to the Error Message. Check it out yourself:

 'https://favqs.com/api/qotd.json',
        CURLOPT_POST            => false,
        CURLOPT_HEADER          => false,
        CURLOPT_SSL_VERIFYPEER  => false,
        CURLOPT_RETURNTRANSFER  => true,
        CURLOPT_SSL_VERIFYHOST  => false,
    );
    $curl               = curl_init();
    curl_setopt_array($curl, $defaults);
    $curl_response      = curl_exec($curl);
    $json_objekat       = json_decode($curl_response);

    // DUMP THE CURL-ERROR INFORMATION:
    var_dump(curl_error($curl));
    curl_close($curl);

##EDITS##Depending on what you are attempting to do; i think you may need an Access Code for this to work correctly and you can get it here:

And when you do; all you have to do is modify your code and add the Authorisation code…

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Why does it not call https rest API using curl in php?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录