Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] SendPhoto from URL #42

Closed
aleritty opened this issue Sep 25, 2015 · 3 comments
Closed

[request] SendPhoto from URL #42

aleritty opened this issue Sep 25, 2015 · 3 comments

Comments

@aleritty
Copy link

Actually your API support only the official method (upload a local file OR reference a file_id).

But automatically handling URL (so submitting as multipart data) can be really useful.

Thank you for your work!!

@irazasyed
Copy link
Owner

Well, We could add support for that but you could simply use built-in PHP functions like file_get_contents and pass on the image URL, then the response to the sendPhoto method.

But thanks for the suggestion though. I'll consider this before the next release and see if we can implement it.

@jonnywilliamson
Copy link
Contributor

+1

@AzizbekDev
Copy link

hi, i couldn't sent photo using this api methods

$response = Telegram::sendPhoto([
  'chat_id' => 'CHAT_ID', 
  'photo' => 'path/to/photo.jpg', 
	'caption' => 'Some caption'
]);

and this is json data and image path

default

and this is my code

    protected function getProducts($chat_id,$category_slug,$manager_slug,$lang='en'){
    $products = file_get_contents('https://test.com/api/products?manager='.$manager_slug.'&category='.$category_slug);
        $data = json_decode($products,true);
        foreach($data['data'] as $product){
        Telegram::sendPhoto([
            'chat_id' => $chat_id,
            'photo' => 'https://test.com/public'.$product['image'],
            'caption' => $product['name']
        ]);
    }

please help me, thanks in advance..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants