2015-08-28 72 views
0

这个错误让我发疯。[Drupal] [Google API]错误403:执行此操作需要SSL

我google了一下,它是由于在https中缺少“s”,但我的代码是正确的,我的端点在url中有“s”,最重要的是,相同的代码在另一个不是我的网站中工作。

http://bidicotest.altervista.org/bidico/book/add

这是网站,尝试寻找一本书和错误将上侧显示。

这是我的代码,我100%肯定它的工作原理

function get_remote_content($search_term) 
{ 
    $api_end_point = "https://www.googleapis.com/books/v1/volumes?q="; 

    $api_param = urlencode($search_term); 

    //Chiamata api a google books 
    $result = drupal_http_request($api_end_point . $api_param); 

    //Se il codice è 200 (ok) o 304 (Not modified) 
    if (in_array($result->code, array(200, 304))) { 
     return print_book_matching_list($result->data); 
    } else { //error 
     return "<p>Si è verificato un errore: controllare la connessione.</p>"; 
    } 
} 

,这让我:

[要求] => GET /书籍/ V1 /卷Q = ASD HTTP/1.0 User-Agent:Drupal(+ http://drupal.org/)Host:www.googleapis.com [data] => {“error”:{“errors”:[{“domain”:“global”,“reason”:“sslRequired },“code”:403,“message”:“SSL需要执行此操作。”}} [protocol] => HTTP/1.0 [ status_message] => Forbidden [headers] => Array([cache-control] => privat e,max-age = 0 [date] => Fri,28 Aug 2015 08:28:11 GMT [accept-ranges] => none [server] => GSE [vary] => Origin,Accept-Encoding [content- type] => application/json; charset = UTF-8 [expires] => Fri,28 Aug 2015 08:28:11 GMT [x-content-type-options] => nosniff [x-frame-options] => SAMEORIGIN [x-xss-protection] => 1; mode = block)[code] => 403 [error] => Forbidden

我已经启用了s2s通信但没有任何改变。

该代码在本地完美工作。

我问在托管公司的论坛,但没有人知道。 我无法自己弄清楚,我在寻求你的帮助。

由于提前, 斯特凡诺

回答