Page 1 of 1

Send Text notification to SAMSUNG TV

Posted: Sat May 25, 2013 12:53 pm
by bilouz
Hello everybody
I am desperate to try to send a message to my TV.
I have read many articles on the forums but I still can not send a message. I understood that he had to use the messageboxservice. I followed all the tutorial posted on the forum (and other SamyGo) but nothing.
I tried setting my network (IP, port), I tried to send a message using sms4TV software successfully so I do not understand.

My idea is to send message via PHP (from NAS device) so I find this one source language.
Here is the source code for my program.

Has anyone succeeded in sending a message to the TV?
Please help me. Thanks a lot
Bilouz

Code: Select all

<?php 

// Adress of Service Web of my TV ** Tested OK 
$post_url  = "http://192.168.0.15:52235/PMR/control/MessageBoxService";

// Body of xml information to post
$xml_builder  ="<?xml version="1.0" encoding="utf-8"?>
  <s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" >
    <s:Body>
      <u:AddMessage xmlns:u="urn:samsung.com:service:MessageBoxService:1\">
        <MessageType>text/xml</MessageType>
        <MessageID>0</MessageID>
        <Message>
          &lt;Category&gt;SMS&lt;/Category&gt;
          &lt;DisplayType&gt;Maximum&lt;/DisplayType&gt;
          &lt;ReceiveTime&gt;
          &lt;Date&gt;2010-05-04&lt;/Date&gt;
          &lt;Time&gt;01:02:03&lt;/Time&gt;
          &lt;/ReceiveTime&gt;
          &lt;Receiver&gt;
          &lt;Number&gt;12345678&lt;/Number&gt;
          &lt;Name&gt;Receiver&lt;/Name&gt;
          &lt;/Receiver&gt;
          &lt;Sender&gt;
          &lt;Number&gt;11111&lt;/Number&gt;
          &lt;Name&gt;Sender&lt;/Name&gt;
          &lt;/Sender&gt;
          &lt;Body&gt;Hello World!!!&lt;/Body&gt;
        </Message>
      </u:AddMessage>
    </s:Body>
  </s:Envelope>";

$ch = curl_init($post_url);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_builder);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  curl_setopt($ch, CURLOPT_REFERER, 'http://www.bharath..co.uk');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $ch_result = curl_exec($ch);
  curl_close($ch);
  // Print CURL result.
  echo $ch_result;
 
?>

Re: Send Text notification to SAMSUNG TV

Posted: Sat May 25, 2013 1:11 pm
by juusso
what is your tv model and firmware?

Re: Send Text notification to SAMSUNG TV

Posted: Sat May 25, 2013 7:35 pm
by bilouz
My model is : PS50C7700 but I think it's possible to send message on this TV because with the program SMS4TV it's OK.
So it's my code source which is wrong i think , but where ???

Re: Send Text notification to SAMSUNG TV

Posted: Sun May 26, 2013 5:48 pm
by juusso
i`m not really familar with php, but there you could read about some solution in bash.

Code: Select all

#! /bin/sh
# usage: ./makeSoap2 "06.05.10 19:19:50;RING;1;1234;4567;SIP1;" 192.168.178.38

# ENTER NETCAT PATH HERE:
#########################
NETCAT="nc"

# TEST IF MESSAGE TYPE IS RING, OTHERWISE QUIT
case $1 in
*RING*)
# SPLIT MESSAGE STRING
DESTINATION=$2
IFS=";"
set -- $1
DATETIME=$1
CALLEE=$5
CALLER=$4

wget -q --tries=3 --timeout=5 -O "tmpfile" "http://www1.dasoertliche.de/?form_name=search_inv&ph=$CALLER"
SUCHZEILE=`grep "nachname" tmpfile`

TMP1=${SUCHZEILE#*nachname=}

IFS="&"
set -- $TMP1
name=$1
street=$2
nr=$3
plz=$4

rm tmpfile

IFS=" "
set -- $DATETIME
CALLDATE=$1
CALLTIME=$2

# BUILD XML
soap="<?xml version=\"1.0\" encoding=\"utf-8\"?>
<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" >
<s:Body>
<u:AddMessage xmlns:u=\"urn:samsung.com:service:MessageBoxService:1\\\">
<MessageType>text/xml</MessageType>
<MessageID>'$(date +%H%M%S)'</MessageID>
<Message>
<Category>Incoming Call</Category>
<DisplayType>Maximum</DisplayType>
<CallTime>
<Date>$CALLDATE</Date>
<Time>$CALLTIME</Time>
</CallTime>
<Callee>
<Number>$CALLEE</Number>
<Name>$CALLER</Name>
</Callee>
<Caller>
<Number>$CALLER</Number>
<Name>$name</Name>
</Caller>
</Message>
</u:AddMessage>
</s:Body>
</s:Envelope>
"

# echo $soap
# echo length: ${#soap}

# BUILD HTTP
message="POST /PMR/control/MessageBoxService HTTP/1.0 
Content-Type: text/xml; charset=\"utf-8\" 
HOST: $DESTINATION 
Content-Length: $((${#soap}+0)) 
SOAPACTION: \"urn:samsung.com:service:MessageBoxService:1#AddMessage\" 
Connection: close 

$soap"

echo "CallMessage send"
#echo lenght: ${#soap}

#echo $message >soapTV
# SEND MESSAGE TO TV
echo $message | $NETCAT -n -w 1 $DESTINATION 52235
;;

*)
;;

esac

Re: Send Text notification to SAMSUNG TV

Posted: Sun May 26, 2013 10:41 pm
by bilouz
Thanks a lot for your help, I m going to test that , soon and I will be back to give a feedback.
Bye
Bilouz