-2

I want to create a XMPP client with php, I tried this code

<?php
include("xmpphp/XMPPHP/xmpp.php");
$conn = new XMPP('192.168.1.62', 5222, 'client', 'pass', 'xmpphp', 'cnx-pc',           $printlog=False, $loglevel=LOGGING_INFO);
$conn->use_encryption = False;
$conn->connect();
$conn->processUntil('session_start');
$conn->message('cnx', 'hi');
$conn->disconnect();
?>

but i have this fatal error Fatal error: Class 'XMPP' not found in D:\EasyPHP-5.3.3.1\www\xmpp1.php on line 3

Any one have an idea about the problem

emna
  • 423
  • 2
  • 6
  • 18

1 Answers1

1

The class name is XMPPHP, not XMPP. Use that, and the error will go away.

Also replace include with require since you rely on the class to exist.

cweiske
  • 30,033
  • 14
  • 133
  • 194
  • I changed it to XMPPHP_XMPP, he accept it but he give me this error – emna May 21 '12 at 14:42
  • Notice: Use of undefined constant LOGGING_INFO - assumed 'LOGGING_INFO' in D:\EasyPHP-5.3.3.1\www\xmpp1.php on line 3 Deprecated: Function split() is deprecated in D:\EasyPHP-5.3.3.1\www\xmpphp\XMPPHP\XMLStream.php on line 266 Deprecated: Function split() is deprecated in D:\EasyPHP-5.3.3.1\www\xmpphp\XMPPHP\XMLStream.php on line 266 Deprecated: Function split() is deprecated in D:\EasyPHP-5.3.3.1\www\xmpphp\XMPPHP\XMLStream.php on line 266 Fatal error: Cannot access protected property XMPPHP_XMPP::$use_encryption in D:\EasyPHP-5.3.3.1\www\xmpp1.php on line 4 – emna May 21 '12 at 14:44
  • then do not access `$use_encryption`. – cweiske May 21 '12 at 15:48