Open recoverjp opened 10 years ago
This is a hash file function: $filehash = base64_encode(hash_file("sha256", $filepath, true)); but only usable when has been saved in whatsapp server. It's possible with upload.
And how can I make upload without use sendMessageImage function?
I need do upload an image and catch filepath, filehash and filesize.
Why do you want to do that? You can upload the file without sending the media file. Check the API code. Follow what sendMessageImage does for example
I want to do this for when the user requests an image, I take forward and not upload.
When I send an image using sendMessageImage(), it does not return me a valid url for the picture which I sent. But when I get a picture using the getMessages(), it returns me a valid url for the image. Can anyone help me?
File name does not matter, you need only file hash and file size to forward media message.
Amirjan, but... $this->sendRequestFileUpload($fhash, 'image', $fsize, $filepath, $to);
And public function sendMessageImage($to, $filepath, $storeURLmedia = false, $fsize = 0, $fhash = "")
I need to send the $filepath, no?
How long a file is stored in the whatsapp server? For example, I uploaded some files that are no longer working: https://mms890.whatsapp.net/d/tow7dxB9q4CCbkdCL7lVlQHa9igABP_tXdjUMQ/AvZFt377o39nPUgrDKhuu7o3vMcUhWD3kzRu4zJfTMQ_.jpg
If you have the file hash and size you dont need to set the path to the file.
WhatsApp media cant be open in browser (computer) try sending that to you
mgp25, can be opened yes, look here https://mmi233.whatsapp.net/d/gRHgZg9NwOzHTw-ZTP4OEW2NNYkABQAiGr2ePg/AgR0SehAFz1hRAsVnqcSH5H4qgbKOcN1z1Ce__JeII7L.jpg
$w->sendMessageImage($to, 'any.jpg', false,147792, '6h3qcEQw+O+F7gUa5gSqv+yZ1aZ6x32172HvTPBXkSo=');
Amirjan, yeah. It worked. Thank so much. My problem now became the files as giving "Media object not found". It is some protection from Whatsapp?
Didnt know that media url could be opened. The device app instead of taking the size and hash takes a hash value and the url, stores that data in a .db.
Nope.
I'll try to upload some examples using this lately
mgp25, when I receive a file using the api, I can grab the full url and access it via the web. But after a few moments the image is no longer accessible.
I developed a website to provide several files that send through whatsapp. For example, audios, videos, pictures. And I need to send these files to the whatsapp server, so that when the user requests this file, it is forwarded. (because it is faster) The problem is that the files are no longer accessible after some time. This is a protection against access via web?
Someone let me know how long a file is stored in the whatsapp servers? For example, I have the hash and size of a file. For how long can I forward this file?
That is a server side function. I think they dont delete anything, and if they find any file duplicate doesnt upload it. I was able to send a file i uploaded +3 month ago :p
mgp25, but why i can't access this file? https://mmi233.whatsapp.net/d/gRHgZg9NwOzHTw-ZTP4OEW2NNYkABQAiGr2ePg/AgR0SehAFz1hRAsVnqcSH5H4qgbKOcN1z1Ce__JeII7L.jpg I sent this file 3 days ago Is it because I accessed it via web?
Maybe. You can try sending the media file using the url, and if you receive the media file, thats it :)
Received media file URLs only have a limited lifetime so people won't use WhatsApp as an image upload service.
hmmmmm ... makes sense
Can I upload a picture and catch the filehash and size? Without sending for any user?