Sending Messages to MSN Direct Watch (fsockopen error)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tomcat7194
Forum Commoner
Posts: 48
Joined: Mon Jul 31, 2006 1:34 pm

Sending Messages to MSN Direct Watch (fsockopen error)

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Their server refused your connection.

That I remember, MSN uses UDP, not TCP.
Tomcat7194
Forum Commoner
Posts: 48
Joined: Mon Jul 31, 2006 1:34 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://www.google.com/search?q=msn+php+class

Taking a quick look at the results.. the initial connection requires SSL.
Tomcat7194
Forum Commoner
Posts: 48
Joined: Mon Jul 31, 2006 1:34 pm

Post 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
Post Reply