venomous0x / WhatsAPI

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

Bot 24/7 online #593

Open ghost opened 10 years ago

ghost commented 10 years ago

Hi,

If i run the script it will keep online for 1 hour. How can i fix it? My code is: http://pastebin.com/eMyNGfV6 Derp is just a placeholder.

Hope you guys can help me…..

zephyern commented 10 years ago

Why does your script disconnect? Is the socket closing or do you get an exception?

ghost commented 10 years ago

I don't know.... The script quites but i can't see any thing in the command line....

zephyern commented 10 years ago

If the script exits, then maybe nothing to do with whatsapi but maybe with the way you're running php? Php has a max_execution_time and set_time_limit which will stop your script after a given amount of time. Neither has a default value of 1hr, but if your script always stops after exactly 1hr it doesn't sound related to whatsapi.

http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

ghost commented 10 years ago

Okay, i'm gonna check the php settings.... Sometimes it's 1hr and sometimes it's 30 minutes....

I'm gonna try it today

ghost commented 10 years ago

Fixed my php settings but still not works….. Any other ideas? At this moment i'm using the screen module in the command line…. i uses php bot.php to run the script…..

eduardochp commented 10 years ago

Why don't use a cronjob for exec the listener file? Every 5 min for example.

ghost commented 10 years ago

Example code?

Verstuurd vanaf mijn iPhone 5c

Op 9 feb. 2014 om 14:37 heeft eduardochp notifications@github.com het volgende geschreven:

Why don't use a cronjob for exec the listener file? Every 5 min for example.

— Reply to this email directly or view it on GitHub.

eduardochp commented 10 years ago

Are you using DreamHost? Is a internal application. Probably it will be in others external servers. Isn't a code is a option in the website.

shirioko commented 10 years ago

Just Google it ffs

ghost commented 10 years ago

I have my own linux server

Verstuurd vanaf mijn iPhone 5c

Op 9 feb. 2014 om 14:42 heeft eduardochp notifications@github.com het volgende geschreven:

Are you using DreamHost? Is a internal application. Probably it will be in others external servers. Isn't a code is a option in the website.

— Reply to this email directly or view it on GitHub.

eduardochp commented 10 years ago

Shirioko I added to my facebook for solve another question did you see?

eduardochp commented 10 years ago

I use this code to get from number:

require 'whatsprot.class.php';

$wa = new WhatsProt('**', '*******', '***'); $wa->Connect(); $wa->loginWithPassword('****'); $msgs = $wa->GetMessages(); foreach($msgs as $message) { $from = $message->getAttribute("from"); echo $from; }

But I try to use for get the user name and nothing...why? how i can solve it? thanks:

$name = $message->getAttribute("name")