venomous0x / WhatsAPI

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

Contactsync.php slow #778

Closed Marcorele closed 10 years ago

Marcorele commented 10 years ago

Hi,

My python script working with Yowsup make the sync with contactsync.php from WhatsAPI.

I tried use :

urllib.urlopen(http://myserver.com/contactsync.php?phone=123456781&pass=xxxxxxxxx&u=12345678)

About 5 sec to have a result...

i tried call the PHP from my Python script :

cmd = ["php-cgi", "-f", "./codephp/sync.php", "phone=%s" % phone_u, "pass=%s" % pass_u, "u=%s" % verif_u] 
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)

about 6-7 sec to have a result

Any method to make a fast contact sync?

Thank you!

mgp25 commented 10 years ago

@Marcorele The loading speed of ContactSync depends exclusively on the number of contacts to sync. The more external methods you use the slower the script goes.

If your question its about yowsup, better in the yowsup repo. I try contactsync and almost instantly I have the result

Marcorele commented 10 years ago

@mgp25 Thanks for your quick repond.

No, i use WhatsAPI to make contactsync (Yowsup can't)

As you can see on my code, i just sync 1 contact...and need about 5sec to have the result.

Instantly?How you call contactsync?

mgp25 commented 10 years ago

@Marcorele modify contactsync.php to run on terminal for example.

php contactsync.php

You can also use arguments for the numbers you want to sync

php contactsync.php 34123456789 34987654321 ...

On webserver it also works and pretty fast, less than a second

Marcorele commented 10 years ago

@mgp25 I already tried both solution. Less than a second? No entiendo...

Marcorele commented 10 years ago

http://marcorele.alwaysdata.net/wapi/contactsync.php?phone="123456"&pass="xxxx"&u="123456"

Need more than 5sec to have result..i tried with differents servers, always same delay

mgp25 commented 10 years ago

@Marcorele Do you know that you have to put the url this way? ...

?phone=123456&pass=xxxx&u[]=123456

Sample script...

<?php

require_once("whatsprot.class.php");

$contacts = array("");

$nickname = "SYNC"; 

$username =     "";
$identity =     "";
$password =     "";

$wa = new WhatsProt($username, $identity, $nickname, TRUE);
$wa->connect();
$wa->loginWithPassword($password);

$wa->sendSync($contacts);
echo "Synced " . count($contacts) . " contacts<br />";

?>
Marcorele commented 10 years ago

@mgp25 Script and sync work fine, URL is good, but very slow

Have a try with my server and you will see what i mean

mgp25 commented 10 years ago

@Marcorele Run the script on your terminal/cmd/shell and test it from there.

Less than a second, tomorrow i'll post here an image with the time, really fast

Marcorele commented 10 years ago

Same delay from terminal :(

mgp25 commented 10 years ago

@Marcorele tomorrow ill post some details here.

Marcorele commented 10 years ago

Thank you for the help!!

shirioko commented 10 years ago

Boop. https://github.com/shirioko/WhatsApiNet-SyncUtil

mgp25 commented 10 years ago

@Shirioko nice! :) thinking to port whatsapp to os x :p

Btw good game (football)

shirioko commented 10 years ago

Ugh I don't care about football. Thanks to that match I won't be able to sleep with all the fucking fireworks and horns :')

You can make it run using Mono. You can fork my project WinApp.NET, I think it "should" be able to run in OS X? It uses standard WinForms components.

Marcorele commented 10 years ago

@shirioko Thank you! WhatsApiNet-SyncUtil is very fast! Do you think make some work on sync method in Yowsup?

mgp25 commented 10 years ago

@Shirioko me neither :p xDDD

Yes, it should work with mono. Hope this stops million of issues like "heeelp contactsync"

Best regards

shirioko commented 10 years ago

@Marcorele I don't think so, I don't know Python 5143552 _66669fdfe7f49414c4dd606880196e78

blueslmj commented 10 years ago

@shirioko is there any methods to make the php API faster? thank you