venomous0x / WhatsAPI

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

Sending Photo #856

Closed YoussefUSF closed 10 years ago

YoussefUSF commented 10 years ago

every time i try to send photo it gave me this error

Fatal error: Call to a member function sendMessageImage() on a non-object in

the code $w->sendMessageImage($target, "demo/x3.jpg");

mgp25 commented 10 years ago

Are you using the latest code? Take a look to exampleFunctional.php

shirioko commented 10 years ago

Looks more like you messed up, your $w is apparently not a WhatsProt object. Can you post the code you're trying to use?

YoussefUSF commented 10 years ago

thank you, i success made @mgp25 in exampleFunction.php i think its wrong, i found that the image sending should be followed up by poll

this is how it worked for me

                       $w->sendPresenceSubscription($target);
            $w->sendMessageComposing($target);
            $w->sendMessagePaused($target);
            $w->sendMessageImage($target, $imagePath);
            $w->pollMessages();
YoussefUSF commented 10 years ago

@shirioko i just gave a piece of code not the full code :D think and im sure that sendMessageImage function need to be followed by pollMessages();

mgp25 commented 10 years ago

In exampleFunctional.php that is inside of an infinite loop, so everytime it starts, it always poll messages.

YoussefUSF commented 10 years ago

@mgp25 oh, ok :+1: Thx for the info