Page 1 of 1

Sending Messages to MSN Direct Watch (fsockopen error)

Posted: Sun Mar 18, 2007 11:24 am
by Tomcat7194
Hello. I am trying to send messages to an MSN Direct watch using code from Spotdev.net
The first part of the code requires making a connection to the MSN server:

Code: Select all

function SendMessages( $passport, $password, $messages ){
	
	//get the correct login first
	$socket = fsockopen( "messenger.hotmail.com", 1863, $errno, $errstr, 30);
 	stream_set_timeout( $socket, 5 );
However, when I try to run that, I get this error:
Warning: fsockopen() [function.fsockopen]: unable to connect to messenger.hotmail.com:1863 (Connection refused) in /home/tomsmith/public_html/test/SendMessages.php on line 33

Warning: stream_set_timeout(): supplied argument is not a valid stream resource in /home/tomsmith/public_html/test/SendMessages.php on line 34
I know that the code works, because there is a successful implementation of it here; when I enter my MSN passport info into that form, the message comes though fine.

Any idea why I can't establish a connection when I run the code on my server?

Thanks
Tom

Posted: Sun Mar 18, 2007 12:11 pm
by feyd
Their server refused your connection.

That I remember, MSN uses UDP, not TCP.

Posted: Sun Mar 18, 2007 12:18 pm
by Tomcat7194
I'm not sure of the difference. Any idea how I ought to be connecting/got a link to a good tutorial?
Thanks
Tom

Posted: Sun Mar 18, 2007 12:20 pm
by feyd
http://www.google.com/search?q=msn+php+class

Taking a quick look at the results.. the initial connection requires SSL.

Posted: Sun Mar 18, 2007 12:55 pm
by Tomcat7194
How would I then go about integrating that into the rest of the code, so I can actually send a message to the watch? I added the includes and the new connection thing, but I'm not sure how to combine that with the rest of the code once the connection is established.

Thanks
Tom