2012-10-09 3 views
0

내가 kannel 1.4.3을 사용하고

여기
group = sms-service 
keyword = default 
# keyword-regex = .* 
catch-all = yes 
max-messages = 0 
post-url = "http://127.0.0.1/sms.php?phone=%p&text=%a&first_keyword=%k&second_keyword=%s&words=%r&binary_message=%b&time=%t&unix_time=%T&sms_id=%I&dr=%d&dr_url=%R&meta_data=%D&dr_smsc_reply=%A&message_coding=%c&message_class=%m&message_waiting_indicator=%m&message_charset=%C&udh=%u&xser0cfield=%B&account_identifier=%o&data_coding_schema=%O&smsc_originating_message=%f" 

이 sms.php 스크립트를하다 아래

<?php 
    require_once dirname(__FILE__)."/send.php"; 
    echo "Ting..\n"; 
    $phone = isset($_POST['phone']) ? ($_POST['phone']."\n"):"??"; 
    $text = isset($_POST['text']) ? ($_POST['text']."\n"):"??"; 

    $username = "tester"; 
    $password = "foobar"; 
    $to = $_POST['phone']; 
    //$text = "Nomor anda adalah : $to"; 
    //$url = "http://127.0.0.1:13013/cgi-bin/sendsms?username=".$username."&password=".$password."&to=".$to."&text=".urlencode($text); 
    // 
    //$result = getCURL($url); 

    $fh = fopen(dirname(__FILE__)."/debug.txt","a"); 

    fwrite($fh, 
     print_r(array(
      'method'=>$_SERVER['REQUEST_METHOD'], 
      'data'=>print_r($_REQUEST,true), 
      'header'=>print_r(getallheaders(), 1) 
     ),true) 
    ); 
    fclose($fh); 
?> 

이 문제가 같은 SMS 서비스를 사용하고 있습니다를 사용하여 메시지를 보낼 때 모든 매개 변수가 $ _POST가 아닌 $ _GET으로 수신되었습니다. 심지어 request_method 값이 POST입니다

어떻게 전화, 텍스트, 키워드, 전자와 같은 모든 매개 변수를 검색 할 수 있습니까? $ _POST를 사용하는 tc? $ _GET 아닌가요?

출력 예 :

Array 
(
    [method] => POST 
    [data] => Array 
(
    [phone] => +6281210*****628 
    [text] => babi pake manjat pohon 
    [first_keyword] => babi 
    [second_keyword] => pake 
    [words] => manjat pohon 
    [binary_message] => babi pake manjat pohon 
    [time] => 2012-10-09 10:05:49 
    [unix_time] => 1349777149 
    [sms_id] => 2f3e12ed-5031-4d5f-b1f2-55e3c41063a4 
    [dr] => -1 
    [dr_url] => %R 
    [meta_data] => %D 
    [dr_smsc_reply] => babi pake manjat pohon 
    [message_coding] => 0 
    [message_class] => -1 
    [message_waiting_indicator] => -1 
    [message_charset] => UTF-8 
    [udh] => 
    [xser0cfield] => 
    [account_identifier] => 
    [data_coding_schema] => 00 
    [smsc_originating_message] => +628*****0000 
) 

    [header] => Array 
(
    [Host] => 127.0.0.1 
    [Connection] => keep-alive 
    [User-Agent] => Kannel/1.4.3 
    [Content-Type] => text/plain 
    [X-Kannel-To] => 13013 
    [X-Kannel-Time] => 2012-10-09 10:05:49 
    [Date] => 2012-10-09 03:05:56 
    [X-Kannel-SMSC] => at-modem 
    [X-Kannel-PID] => 0 
    [X-Kannel-Alt-DCS] => 0 
    [X-Kannel-Coding] => 0 
    [X-Kannel-Compress] => 0 
    [X-Kannel-Service] => default 
    [Content-Length] => 22 
) 

) 

답변

0

했다 동일한 문제가 문제 ... 내가 사용하는 모든이 .. PHP를 사용 $_REQUEST 대신했다 그래서 $_GET 또는 $_POST 오전 수있는 프로세스가 정보의 경우는 문제가되지 않습니다. 당신은 POST 요청을하려면

당신은 쿼리 문자열이 아닌 POST 데이터, 내부의 매개 변수를 설정하는 당신의 예에서 post-xml 옵션

1

을 시도 할 수 있습니다 당신은 왜 $ _GET 그들을에서보고있는 .

Kannel이 게시 필드가 아닌 X-Kannel- * HTTP 헤더로 데이터를 전송하기 때문에 $ _POST가 비어 있습니다.

gw/smsbox.c 줄 1306-1431 (v1.4.4) 참조 ... userguide.xml의 userguide에만 있기 때문에 소스를 읽으면 어떤 헤더 이름이 사용되는지 알 수 있습니다.

post-url에 어떤 이름이 사용되는지 선택할 수없고 모든 매개 변수를 선택하지 않아도됩니다. 모든 매개 변수는 모든 요청에 ​​대해 전송됩니다.