nilovese / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

connect to facebook chat server using xmpphp... #105

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi all,

I was trying connect to Facebook by this Library, but it seems doesn't work.

This is my setting:

$conn = new XMPPHP_XMPP('chat.facebook.com', 5222, 'username',  'facebook', 
'xmpphp', 'chat.facebook.com', $printlog=true, 
$loglevel=XMPPHP_Log::LEVEL_INFO);

And also I close SSL: $conn->useEncryption(False);

error code:
1294151997 [INFO]: Connecting to tcp://chat.facebook.com:5222 1294151998 
[INFO]: Attempting Auth... 1294151998 [ERROR]: Auth failed! Auth failed!

Maybe i still miss something?

Original issue reported on code.google.com by heinous...@gmail.com on 4 Jan 2011 at 2:53

GoogleCodeExporter commented 8 years ago
It work!

just needs install MD5 in xmppphp

now it works really nice QAQ

Cheers

Original comment by heinous...@gmail.com on 4 Jan 2011 at 4:18

GoogleCodeExporter commented 8 years ago
what you mean install MD5?
I can't get it to work can advise?

Original comment by monster....@gmail.com on 15 Feb 2011 at 10:53

GoogleCodeExporter commented 8 years ago
Hi,

try this one 

http://code.google.com/p/xmpphp/issues/detail?id=67

and make sure u have a newest xmpphp

Original comment by heinous...@gmail.com on 15 Feb 2011 at 11:33

GoogleCodeExporter commented 8 years ago
I used the patch at http://code.google.com/p/xmpphp/issues/detail?id=67 nut it 
doesn't work. Are you sure that it works?

Original comment by zxwzx...@gmail.com on 27 Feb 2011 at 10:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hey,
i have the same Problem: "Auth failed". I have tested the newest Version of 
XMPPHP with "Diggest MD5" Patch. Still the same Problem. Is there any way how 
it works? Please give me a short information.

Original comment by gaj...@e-masters.de on 11 Apr 2011 at 11:54

GoogleCodeExporter commented 8 years ago
Hi,
Login username is not your email(http://www.facebook.com/sitetour/chat.php)

goto facebook->Account->Account_Settings->Settings->Username

After set a username , facebook need several hours active it.

blog version: http://hdog.tw/wordpress/?p=67

cheers

Original comment by heinous...@gmail.com on 14 Apr 2011 at 5:57

GoogleCodeExporter commented 8 years ago
Could you please tell how I can send an email to user? What format I should use 
for it, username alias or something like username@chat.facebook.com 
($conn->message('username@chat.facebook.com', 'This is a test message!')?   

Thanks in advance

Original comment by anna.vak...@gmail.com on 14 Apr 2011 at 2:53

GoogleCodeExporter commented 8 years ago
I got it! But how I can recognize what is the user I get only id numbers but I 
need to get username instead?!

Original comment by anna.vak...@gmail.com on 14 Apr 2011 at 3:59

GoogleCodeExporter commented 8 years ago
@8: Exactly this Way i have tested. Shure that it works?

Original comment by gaj...@e-masters.de on 18 Apr 2011 at 12:45

GoogleCodeExporter commented 8 years ago
You can retrieve Vcard in order to find whois the user behind the facebook id. 
(key "fn")
I added a hash table with facebook ID linked to name and picture.

Original comment by mysterc...@gmail.com on 22 Jun 2011 at 6:29

GoogleCodeExporter commented 8 years ago
i m having the same issue ..
when i try to connect to chat.facebook.com ,i get an error --

 [ERROR]: Auth failed! 1309761158 [VERBOSE]: Disconnecting... 1309761158 [VERBOSE]: Socket is ready; send it. 1309761158 [VERBOSE]: SENT: 1309761158 [VERBOSE]: Successfully sent 16 bytes. 1309761158 [VERBOSE]: RECV: 1309761158 [VERBOSE]: Error on stream_select() 

--my xmpp object declaration is --
$xmpp=new XMPPHP_XMPP('chat.facebook.com', '5222', 'user@chat.facebook.com', 
'pass','xmpphp','chat.facebook.com',$printlog=TRUE,$loglevel=  
XMPPHP_Log::LEVEL_VERBOSE);

i have tried the xmpp file with the digest-md5 but still the same problem 
exists ....
any suggestions?
thnx.

Original comment by karybo...@gmail.com on 4 Jul 2011 at 6:42

GoogleCodeExporter commented 8 years ago
I am able to connect with username@chat.facebook.com

$conn = new XMPPHP_XMPP('chat.facebook.com', 5222, 'fb-username', 
'fb-password', 'xmpphp', 'chat.facebook.com', $printlog=true, 
$loglevel=XMPPHP_Log::LEVEL_VERBOSE);

The script is able to authenticate user and also shows "Message sent 
successfully". But I do not get chat alert in facebook.

Can anyone plz help.

Original comment by appdevel...@gmail.com on 23 Jul 2011 at 6:12

GoogleCodeExporter commented 8 years ago
1320307995 [VERBOSE]: SENT: <message 
from="xxxxxx@chat.facebook.com/xmpphp_9f614541_4B0D0290B6F32" 
to="xxxx@chat.facebook.com" type='chat'><body>This is a test 
message!</body></message>
1320307995 [VERBOSE]: Successfully sent 162 bytes.
1320307995 [VERBOSE]: Disconnecting...
1320307995 [VERBOSE]: Socket is ready; send it.
1320307995 [VERBOSE]: SENT: </stream:stream>
1320307995 [VERBOSE]: Successfully sent 16 bytes.
1320307995 [VERBOSE]: RECV: <presence from="-731951394@chat.facebook.com" 
to="xxx@chat.facebook.com/xmpphp_9f614541_4B0D0290B6F32"><x 
xmlns="vcard-temp:x:update"><photo>8eb8739ddbd6f99f3d70b722784a6ba9af799b4e</pho
to></x></presence>
1320307995 [DEBUG]: Calling presence_handler
1320307995 [DEBUG]: Presence: -731951394@chat.facebook.com [available] 
1320307995 [DEBUG]: EVENT: presence
1320307996 [VERBOSE]: RECV: </stream:stream>
1320307996 [DEBUG]: EVENT: end_stream

is it that works?
but I can't get facebook's alter,  same as the problem appdevel...@gmail.com, 
please anyone can help?

Original comment by templ...@gmail.com on 3 Nov 2011 at 8:31

GoogleCodeExporter commented 8 years ago
I was facing the same problem, but now i noticed something (look for:  -> & =>)

   1340234085 [INFO]: Attempting Auth...
   1340234085 [VERBOSE]: Socket is ready; send it.
   1340234085 [VERBOSE]: SENT: AGt1b**********************************KjQ3MTAxMDUyMDA4Kio=
   1340234085 [VERBOSE]: Successfully sent 128 bytes.
   1340234085 [INFO]: Trying DIGEST-MD5 (available : DIGEST-MD5)
   1340234085 [VERBOSE]: Socket is ready; send it.
   1340234085 [VERBOSE]: SENT:
   1340234085 [VERBOSE]: Successfully sent 72 bytes.
   1340234085 [VERBOSE]: RECV:
-> 1340234085 [DEBUG]: Calling sasl_failure_handler
-> 1340234085 [ERROR]: Auth failed!
-> 1340234085 [VERBOSE]: Disconnecting...
   1340234085 [VERBOSE]: Socket is ready; send it.
   1340234085 [VERBOSE]: SENT:
   1340234085 [VERBOSE]: Successfully sent 16 bytes.
=> 1340234086 [VERBOSE]: RECV: 
cmVhbG09ImNoY**********************************************DcwOTRBRDg5MkZGMjk3OU
EwNzkiLHFvc*********************************bWQ1LXNlc3M=
   1340234086 [VERBOSE]: RECV:
   1340234086 [VERBOSE]: Error on stream_select()
   1340234086 [VERBOSE]: Error on stream_select()

though script is getting reply for authetication (ref =>) but still.. the 
script is terminating itself (ref ->)

making this a comment is working for me!
$this->addXPathHandler('{urn:ietf:params:xml:ns:xmpp-sasl}failure', 
'sasl_failure_handler');

1340233919 [INFO]: Attempting Auth...
1340233919 [VERBOSE]: Socket is ready; send it.
1340233919 [VERBOSE]: SENT: 
AGt1*************************JvY2tzKj****TAxMDUyMDA4Kio=
1340233919 [VERBOSE]: Successfully sent 128 bytes.
1340233919 [INFO]: Trying DIGEST-MD5 (available : DIGEST-MD5)
1340233919 [VERBOSE]: Socket is ready; send it.
1340233919 [VERBOSE]: SENT:
1340233919 [VERBOSE]: Successfully sent 72 bytes.
1340233919 [VERBOSE]: RECV:
1340233920 [VERBOSE]: RECV: 
cm********************************************************RjgzRTIwMjczNTk1MTQiLH
FvcD0iYXV0a***************************dvcml0aG09bWQ1LXNlc3M=
1340233920 [DEBUG]: Calling sasl_challenge_handler
1340233920 [VERBOSE]: Socket is ready; send it.
1340233920 [VERBOSE]: SENT: 
dXNlcm5hbWU9Imt1bWFycm9oaXQwMxxxxxxxxxxxxxxxxxxxxxxxxLmNvbSIsbm9uxxxxxxxxxxxDAxN
kM3NjM2xxxxxxxxxxxxxxxU5NTE0Iixjbm9uY2U9IjxxxxxxxxxxxxxxxxxxxxxxxxM9MDAwMDAwMDEs
cW9wPWF1dGxxxxxxxxxxxxxxxxxxxxxxxxxxxxVib29rLmNvbSIscmVzcG9uc2U9YjA3MjgzYTY2MTI4
OWM3xxxxxjNjxxxxxxxxxxxxxxxxxxxxxxxGYtOA==
1340233920 [VERBOSE]: Successfully sent 378 bytes.
1340233921 [VERBOSE]: RECV: 
cnNwYXV*********************************EwNDZkYmU0Yg==
1340233921 [DEBUG]: Calling sasl_challenge_handler
1340233921 [VERBOSE]: Socket is ready; send it.
1340233921 [VERBOSE]: SENT:
1340233921 [VERBOSE]: Successfully sent 52 bytes.
1340233924 [VERBOSE]: RECV:
1340233924 [DEBUG]: Calling sasl_success_handler
1340233924 [INFO]: Auth success!

but I don't see at it as a solution!

any solution for this??

Original comment by sorcerer.rohit on 24 Jun 2012 at 6:04

GoogleCodeExporter commented 8 years ago
Sorry guys.. 

   if ($this->password) {
-> $this->send("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' 
mechanism='PLAIN'>" .  base64_encode("\x00" . $this->user . "\x00" . 
$this->password) . "</auth>");
   $mechanism = 'PLAIN'; // default;

-> wasn't supposed to be there in xmpp.php!

Original comment by sorcerer.rohit on 24 Jun 2012 at 6:20

GoogleCodeExporter commented 8 years ago
1341817375 [INFO]: Connecting to tcp://talk.google.com:80 1341817375 [VERBOSE]: 
Socket is ready; send it. 1341817375 [VERBOSE]: SENT: 1341817375 [VERBOSE]: 
Successfully sent 114 bytes. 1341817376 [VERBOSE]: RECV: X-GOOGLE-TOKENX-OAUTH2 
1341817376 [DEBUG]: Calling features_handler 1341817376 [INFO]: Attempting 
Auth... 1341817376 [VERBOSE]: Socket is ready; send it. 1341817376 [VERBOSE]: 
SENT: AHNocmkAZGltZGlt 1341817376 [VERBOSE]: Successfully sent 88 bytes. 
1341817376 [VERBOSE]: RECV: 1341817376 [DEBUG]: Calling sasl_failure_handler 
1341817376 [ERROR]: Auth failed! 1341817376 [VERBOSE]: Disconnecting... 
1341817376 [VERBOSE]: Socket is ready; send it. 1341817376 [VERBOSE]: SENT: 
1341817376 [VERBOSE]: Successfully sent 16 bytes. 1341817376 [VERBOSE]: Error 
on stream_select() 
Warning: fclose() expects parameter 1 to be resource, null given in 
C:\xampp\htdocs\sivra\chat\xmpphp-0.1rc2-r77\XMPPHP\XMLStream.php on line 403
Auth failed!
Any solution for this?

Original comment by leelam.a...@gmail.com on 9 Jul 2012 at 7:06

GoogleCodeExporter commented 8 years ago
i am getting "auth fail" message while trying to connect chat.facebook.com. 
It's because facebook allow X-FACEBOOK-PLATFORM mechanism for authentication 
and XMPPHP is sending DIGEST-MD for it.

any suggestion or patch ? ? ?

Original comment by karan.sa...@gmail.com on 22 Aug 2012 at 9:54