首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GAE支持Plivo吗?

GAE支持Plivo吗?
EN

Stack Overflow用户
提问于 2015-09-21 17:18:29
回答 1查看 90关注 0票数 0

我一直试图在我的GAE服务器上实现Plivo,但是我得到了一个500 error

我使用Plivo的Github帮助程序库设置了Plivo。我将该文件作为plivo.php保存在我的测试服务器上。然后,我用以下代码添加了plivosend.php

代码语言:javascript
复制
<?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."}';
    }
}
?>

在我的测试服务器(只是我的网站)上,这发送没有任何问题。当我把plivo.phpplivosend.php放在GAE上时,我得到了下面的500 error

代码语言:javascript
复制
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吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-22 05:18:12

Google限制了许多功能(为了成为一个大规模自动缩放应用程序平台所必需的)。一个限制是出站HTTP请求(从PHP代码到外部)。在这里阅读,HTTP请求和cURL支持获得详细信息和选项。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32701069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档