SEND MESSAGE - NEED HELP PLEASE
How can I send messages from my appliation to yahoo messenger. I have added the user of the application on yahoo messenger. When I try to send message, using the function I don;t get anything
public function send_message($user, $message) ( i presume user and message is the user name on yahoo messenger, and not the user of the application)
need help, please
this is the code:
Random rand = new Random();
int randNo = rand.Next(1000, 9999);
string uri = URL_YM_MESSAGE +
"?oauth_consumer_key=" + CONSUMER_KEY +
"&oauth_nonce=" + randNo.ToString() +
"&oauth_signature=" + SECRET_KEY + "%26" + OAUTH_TOKEN_SECRET +
"&oauth_signature_method=PLAINTEXT" +
"&oauth_timestamp=" + DateTime.Now +
"&oauth_token=" + OAUTH_TOKEN +
"&oauth_version=1.0" +
"&sid=" + SESSION_ID;
uri = uri.Replace("{{USER}}", usernam); -< the user name on yahoo messenger and not the one on c# application
string postData = "{ \"message\" :" + message+ "}";
HttpWebRequest messageRequest = WebRequest.Create(uri) as HttpWebRequest;
messageRequest.Method = "POST";
messageRequest.ContentType = "application/json;charset=utf-8"
messageRequest.ContentLength = postData.Length;
Stream dataStream = messageRequest.GetRequestStream();
UTF8Encoding encoder = new UTF8Encoding();
byte[] bytes = encoder.GetBytes(postData);
dataStream.Write(bytes, 0, bytes.Length);
//dataStream.Flush();
by
3 Replies