Error in server response: End of input at character 0 of

38 views
Skip to first unread message

Sergiu

unread,
May 22, 2019, 9:25:39 AM5/22/19
to envayasms
Don't know if anybody can still answer my question but I'll try anyway:

I almost finished my server for EnvayaSMS and even though I can send messages and send logs to the phone successfully I still receive "Error in server response: End of input at character 0 of" in the phone app logs when querying for new messages.

My responses:

for action=outgoing:

{   "events": [     {       "event": "send",       "messages": [         {           "id": "1",           "to": "000",           "message": "mes1"         },         {           "id": "2",           "to": "000",           "message": "mes2"         },         {           "id": "3",           "to": "000",           "message": "mes3"         }       ]     }   ] }

for action=send_status:

{"events":[{"event":"log","message":"Message with id: x  was removed from database"}]}

Anybody can tell me what's going on?

Thank you,

Alban Jamesse

unread,
May 22, 2019, 3:43:40 PM5/22/19
to enva...@googlegroups.com
Hello Sergiu;

Have you set properly your header ?
Your content type must be application/json.

It’s just a way, I’m not sure it’s the solution.


--
You received this message because you are subscribed to the Google Groups "envayasms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to envayasms+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/envayasms/c6994c46-697d-4897-9fd5-77751646ce86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Alban JAMESSE
https://www.alban.us/ - +33 687 007 697

Sergiu

unread,
May 23, 2019, 8:37:00 AM5/23/19
to envayasms
Hi Alban,

Yes, the response headers are set to Content-Type: application/json.

On Wednesday, 22 May 2019 22:43:40 UTC+3, Alban wrote:
Hello Sergiu;

Have you set properly your header ?
Your content type must be application/json.

It’s just a way, I’m not sure it’s the solution.
Le mer. 22 mai 2019 à 15:25, Sergiu <srj...@gmail.com> a écrit :
Don't know if anybody can still answer my question but I'll try anyway:

I almost finished my server for EnvayaSMS and even though I can send messages and send logs to the phone successfully I still receive "Error in server response: End of input at character 0 of" in the phone app logs when querying for new messages.

My responses:

for action=outgoing:

{   "events": [     {       "event": "send",       "messages": [         {           "id": "1",           "to": "000",           "message": "mes1"         },         {           "id": "2",           "to": "000",           "message": "mes2"         },         {           "id": "3",           "to": "000",           "message": "mes3"         }       ]     }   ] }

for action=send_status:

{"events":[{"event":"log","message":"Message with id: x  was removed from database"}]}

Anybody can tell me what's going on?

Thank you,

--
You received this message because you are subscribed to the Google Groups "envayasms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enva...@googlegroups.com.

Alban

unread,
May 23, 2019, 9:16:53 AM5/23/19
to envayasms
Can you copy paste the exact portion of code.
You must have an hidden character in your code before your {, like a tab or something like that.

Sergiu

unread,
May 23, 2019, 9:24:04 AM5/23/19
to envayasms
    foreach ($messages as $message) { //Looping through all messages that are to be sent

//Creating the Object with messages
        $Obj
= new stdClass();
        $Obj
->id = $message['id'];
        $Obj
->to = $message['tel'];
        $Obj
->message = "message";

        array_push
($mesArray, $Obj);
   
}

    $Obj
= new stdClass();
//Creating the entire response
    $Obj
->events = array(array("event" => "send", "messages" => $mesArray));
    $json
= json_encode($Obj);
    echo $json
; //Sending the response

Sergiu

unread,
May 23, 2019, 9:33:30 AM5/23/19
to envayasms
and the reply for send_status:

            $Obj = new stdClass();
            $Obj
->events = array(array("event" => "log", "message" => "some message to log"));
            echo json_encode
($Obj);



On Thursday, 23 May 2019 16:16:53 UTC+3, Alban wrote:

Sergiu

unread,
May 27, 2019, 10:51:22 AM5/27/19
to envayasms
I have managed to solve the issue, it was the option "Forward sent messages" from the app.
Reply all
Reply to author
Forward
0 new messages