我在处理从我用于我的应用程序 ( http://Cameratag.com ) 的服务发送的回调时遇到了一些问题。
我只是想获取从 Cameratag 发送的数据并用它做事。
下面是我试图开始工作的“测试”脚本。但是我很难找出什么不起作用。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Process_video_test extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('email');
}
public function index()
{
$raw = file_get_contents('php://input');
$json = json_decode($raw, true);
$uuid = $json["uuid"];
$this->email->from('Senders@email.com', 'Senders Name');
$this->email->to('Recievers@email.com');
$this->email->subject($uuid);
$this->email->message($uuid);
$this->email->send();
}
}
当我将数据重新发送到此脚本时,什么也没有发生。即使您访问或卷曲此脚本的 url,它也会发送一封空白电子邮件。当我重新发送回调时,我什么也得不到。
回调服务器肯定也在发布数据,我可以在我的服务器日志中找到以下内容:
54.224.22.73 - - [09/Oct/2013:07:07:50 -0500] "POST /process_video_test?uuid=59fbe950-0150-0131-7bd6-22000a8fabd6&camera_uuid=732c58e0-ea3f-0130-73d4-22000aecbdd8&created_at=2013-09-16%2022%3A50%3A47%20UTC&percent_complete=100&short_code=eMOhvg&metadata[email]=Coeyman%40gmail.com&state=published&recorded_from=http%3A%2F%2Fjordan.crowdengage.com%2F&publish_type=webcam&formats[][name]=vga&formats[][width]=640&formats[][height]=480&formats[][video_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fvga%2Fmp4&formats[][mp4_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fvga%2Fmp4&formats[][webm_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fvga%2Fwebm&formats[][thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fvga%2Fthumb&formats[][small_thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fvga%2Fsmall_thumb&formats[][state]=COMPLETED&formats[][completed_at]=2013-09-16%2022%3A51%3A57%20UTC&formats[][name]=360p&formats[][width]=480&formats[][height]=360&formats[][video_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2F360p%2Fmp4&formats[][mp4_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2F360p%2Fmp4&formats[][webm_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2F360p%2Fwebm&formats[][thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2F360p%2Fthumb&formats[][small_thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2F360p%2Fsmall_thumb&formats[][state]=COMPLETED&formats[][completed_at]=2013-09-16%2022%3A51%3A58%20UTC&formats[][name]=qvga&formats[][width]=320&formats[][height]=240&formats[][video_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fqvga%2Fmp4&formats[][mp4_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fqvga%2Fmp4&formats[][webm_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fqvga%2Fwebm&formats[][thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fqvga%2Fthumb&formats[][small_thumbnail_url]=http%3A%2F%2Fcameratag.com%2Fvideos%2F59fbe950-0150-0131-7bd6-22000a8fabd6%2Fqvga%2Fsmall_thumb&formats[][state]=COMPLETED&formats[][completed_at]=2013-09-16%2022%3A51%3A56%20UTC HTTP/1.1" 403 18156 "-" "-"
编辑:
我尝试了以下代码作为我的索引文件:
类 Process_video_test 扩展 CI_Controller {
public function index()
{
$debug_me = 1;
$raw = file_get_contents('php://input');
$json = json_decode($raw, true);
if ($debug_me) {
ob_start();
var_dump('raw:', $raw, 'json:', $json);
log_message('info', ob_get_contents());
ob_end_clean();
}
}
在我的日志文件中如下:
DEBUG - 2013-10-09 10:01:12 --> Config Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Hooks Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Utf8 Class Initialized
DEBUG - 2013-10-09 10:01:12 --> UTF-8 Support Enabled
DEBUG - 2013-10-09 10:01:12 --> URI Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Router Class Initialized
DEBUG - 2013-10-09 10:01:12 --> No URI present. Default controller set.
DEBUG - 2013-10-09 10:01:12 --> Output Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Security Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Input Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Global POST and COOKIE data sanitized
DEBUG - 2013-10-09 10:01:12 --> Language Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Loader Class Initialized
DEBUG - 2013-10-09 10:01:12 --> Helper loaded: utility_helper
DEBUG - 2013-10-09 10:01:12 --> Helper loaded: url_helper
DEBUG - 2013-10-09 10:01:12 --> Helper loaded: menu_helper
DEBUG - 2013-10-09 10:01:13 --> Database Driver Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Config file loaded: application/config/ion_auth.php
DEBUG - 2013-10-09 10:01:13 --> Email Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Language file loaded: language/english/ion_auth_lang.php
DEBUG - 2013-10-09 10:01:13 --> Helper loaded: cookie_helper
DEBUG - 2013-10-09 10:01:13 --> Helper loaded: language_helper
DEBUG - 2013-10-09 10:01:13 --> Session Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Helper loaded: string_helper
DEBUG - 2013-10-09 10:01:13 --> A session cookie was not found.
DEBUG - 2013-10-09 10:01:13 --> Session routines successfully run
DEBUG - 2013-10-09 10:01:13 --> Model Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Model Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Helper loaded: date_helper
DEBUG - 2013-10-09 10:01:13 --> REST Class Initialized
DEBUG - 2013-10-09 10:01:13 --> cURL Class Initialized
DEBUG - 2013-10-09 10:01:13 --> Controller Class Initialized
DEBUG - 2013-10-09 10:01:13 --> File loaded: application/views/includes/header.php
DEBUG - 2013-10-09 10:01:13 --> File loaded: application/views/landing.php
DEBUG - 2013-10-09 10:01:13 --> File loaded: application/views/includes/footer.php
DEBUG - 2013-10-09 10:01:13 --> File loaded: application/views/includes/template.php
DEBUG - 2013-10-09 10:01:13 --> Final output sent to browser
DEBUG - 2013-10-09 10:01:13 --> Total execution time: 0.3939