0

GAE サーバーに Plivo を実装しようとしていますが、500 error.

Plivo の Github PHP Helper Libraryを使用して、Plivo をセットアップします。そのファイルをテストサーバーにplivo.phpとして保存しました。次に、次のコードでplivosend.phpを追加しました

<?php
if($_POST) {
    require_once 'plivo.php';
    $auth_id = "auth_id";
    $auth_token = "auth_token";

    $p = new RestAPI($auth_id, $auth_token);

    // make sure all 3 params are valid
    if(!empty($_POST['send_to_name']) && !empty($_POST['send_to_number']) && !empty($_POST['sender_name'])) {

        $message = 'this message doesn't matter';
        $plivo_url = 'https://glacial-harbor-8656.herokuapp.com/report';

        // Send message
        $params = array(
                'src' => '15555555555',             // Sender's phone number with country code
                'dst' => $_POST['send_to_number'],    // Receiver's phone number with country code
                'text' => $message,                 // Your SMS text message
                'url' => $plivo_url,                // The URL to which with the status of the message is sent
                'method' => 'POST'                  // The method used to call the url
            );

        // Send message
        $response = $p->send_message($params);

        // Print the response
        $message_uuid = $response['response']['message_uuid'][0];

        if(!empty($message_uuid)) {
            echo '{"success":1,"message_uuid":' . $message_uuid . '"}';
        }
        else {
            // todo log this?
            echo '{"success":0,"error_message":"Message failed to send."}';
        }
    }
    else {
        echo '{"success":0,"error_message":"Message failed to send. Incorrect params."}';
    }
}
?>

私のテスト サーバー (私の Web サイトのみ) では、これは問題なく送信されます。plivo.phpと の両方をplivosend.phpGAEに置くと、次のようになります500 error

207.58.203.50 - - [21/Sep/2015:09:58:00 -0700] "POST /plivosend.php HTTP/1.1" 500 25 - "appname/1.0.2 (iPhone; iOS 9.0; Scale/2.00)" "appname-xxx.appspot.com" ms=4 cpu_ms=3 cpm_usd=0.000003 instance=00c61b117cd04d3645448a84e24daba9991882e1 app_engine_release=1.9.26

理由はわかりません...詳細は非常に限られています。

誰も手がかりを持っていますか?GAE は Plivo をサポートしていませんか?

4

1 に答える 1

1

Google App Engine は多くの機能を制限します (大規模な自動スケーリング アプリケーション プラットフォームにするために必要です)。1 つの制限は、アウトバウンド HTTP リクエスト (PHP コードから外部へ) です。詳細とオプションについては、HTTP Requests and cURL Supportを参照してください。

于 2015-09-22T05:18:12.730 に答える