abhishekphp6 Posted May 5, 2010 Share Posted May 5, 2010 I copy pasted the following php code <?php include('XMPPHP/XMPPHP/XMPP.php'); $conn = new XMPP('talk.google.com', 5222, '[email protected]', 'pappu617', 'xmpphp', 'gmail.com', printlog=False, $loglevel=LOGGING_INFO); $conn->connect(); $conn->processUntil('session_start'); $conn->message('[email protected]', 'this is a test message'); $conn->disconnect(); ?> But it gives me error Parse error: syntax error, unexpected '=' in /var/www/foo.php on line 3 Do I need to install something before using new? I am using ubuntu linux 9.1.0 php 5.2.10-2ubuntu6.4 Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/ Share on other sites More sharing options...
TeddyKiller Posted May 5, 2010 Share Posted May 5, 2010 It might be $loglevel=LOGGING_INFO but not sure. You might need to install something.. although, I can say.. we aren't google. I can't help you on that one. Although I suggest.. taking your email and password out of the code.. Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053596 Share on other sites More sharing options...
Alex Posted May 5, 2010 Share Posted May 5, 2010 Yeah, that is the problem. If you want to leave out those parameters just leave them blank. $conn = new XMPP('talk.google.com', 5222, '[email protected]', 'pappu617', 'xmpphp', 'gmail.com'); Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053600 Share on other sites More sharing options...
TeddyKiller Posted May 5, 2010 Share Posted May 5, 2010 Yeah, that is the problem. If you want to leave out those parameters just leave them blank. $conn = new XMPP('talk.google.com', 5222, '[email protected]', 'pappu617', 'xmpphp', 'gmail.com'); What if he wanted them in? Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053611 Share on other sites More sharing options...
Alex Posted May 5, 2010 Share Posted May 5, 2010 Then he would fill them in. From the looks of the code I'd guess that he copied the function declaration which includes default values for those parameters. Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053612 Share on other sites More sharing options...
abhishekphp6 Posted May 5, 2010 Author Share Posted May 5, 2010 How to edit the message. I have copy pasted my email id and password. I have changed the password... but I want to remove it from here. Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053644 Share on other sites More sharing options...
abhishekphp6 Posted May 5, 2010 Author Share Posted May 5, 2010 Also, can you please download this library from here http://code.google.com/p/xmpphp/ and try to make this code work? for me it simply states that Fatal error: Class 'XMPP' not found in /var/www/XY.php on line 99 I am pretty sure that I have included the path to XMPP.php correctly. Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053650 Share on other sites More sharing options...
TeddyKiller Posted May 5, 2010 Share Posted May 5, 2010 In XY.php, you should have an include include("xmpp.php"); Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053653 Share on other sites More sharing options...
abhishekphp6 Posted May 5, 2010 Author Share Posted May 5, 2010 I have the include statement. include('XMPPHP/XMPPHP/XMPP.php'); Here the file XMPP.php resides in a directory path XMPPHP/XMPPHP under the www directory where the XY.php file resides. I have also kept the case as-is Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053676 Share on other sites More sharing options...
ignace Posted May 5, 2010 Share Posted May 5, 2010 I believe the error occurs due to: printlog=False Which possibly should have been: $printlog=False Link to comment https://forums.phpfreaks.com/topic/200794-using-new-keyword-in-php/#findComment-1053719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.