venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.14k forks source link

Parse error: syntax error, unexpected '[' in Chat-API-master\src\protocol.class.php on line 90 #1184

Open kussio opened 8 years ago

kussio commented 8 years ago

Hi, I'm a new user wanted to use whatsapp api to write on php bot to automatically send messages. But when writing faced such problem "Parse error: syntax error, unexpected '[' in ./Chat-API-master\src\protocol.class.php on line 90". Why is an error, what is the Problem?

kussio commented 8 years ago

This is my code, please make sure everything is correct, I wrote?

<? php require_once 'src / whatsprot.class.php'; $ id = "..."; // my id $ username = "..."; //My phone number $ nickname = 'Kurban'; // My nickname $ password = '...'; //password $ debug = True; $ log = true; //

require '/src/events/MyEvents.php';   $ w = new WhatsProt ($ username, $ nickname, $ debug, $ log); // Name your application by replacing "WhatsApp Messaging" $ events = new MyEvents ($ w); $ events -> setEventsToListenFor ($ events -> activeEvents);

$ w -> Connect (); $ w -> loginWithPassword ($ password);   // Create an instance of the class registration $ r = new Registration ($ username, $ debug); $ r -> codeRequest ('sms');

$ target = '...'; // Trust telephone, receiving $ message = 'Your message comes here'; // message   $ w -> sendPresenceSubscription ($ target); // Please send user presence $ w -> SendMessage ($ target, $ message); // Send a message ?>

douweyntema commented 8 years ago

Same issue to me. In other forums people say PHP version must be >= 5.3 Mine is 5.3.29