I am totally new to Laravel frame work ! I know this issue is because of that ! but PLZ help Me !
I do not know how to add this Packege in Providers ! Actually I have done steps and I have telegram.php in config folder now ! but I am getting this Err :
Undefined variable: telegram
while I want test my bot like this :
echo $response = $telegram->getMe();
No worries!
Did you add the facade ? If not just add it as that would be easier.
Once you do that. All you have to do is, make calls like for example:
$response = Telegram::getMe();
Then you can print the response.
Any method you want to use, You can use the facade. So instead of doing $telegram->getMe() you would prefix the methods with Telegram::.
If you don't want to use facade for whatever reasons. You can also access it like:
$response = app('telegram')->getMe();
But i would recommend you use Facade so it's much more cleaner and easier.
Thanks For Replying Back !
When I tried :
$resopnse = Telegram::getMe();
I got this error :
TelegramSDKException in GuzzleHttpClient.php line 97:
cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I have added these lines to My app.php plz check if Have added everything Ok or not :
{Providers}...
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Irazasyed\Telegram\Laravel\TelegramServiceProvider::class,
],
...
{aliases}...
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Telegram' => Irazasyed\Telegram\Laravel\Facades\Telegram::class
],
THis is the detail of My Error : (May be Useful):
in GuzzleHttpClient.php line 97
at GuzzleHttpClient->send('https://api.telegram.org/<token>/getMe', 'GET', array('User-Agent' => 'Telegram Bot PHP SDK v0.2.2 - (https://github.com/irazasyed/telegram-bot-sdk)'), array('query' => array()), '60', false) in TelegramClient.php line 116
(Changed the Token in this comment)
Alright, Thanks for posting the error message.
I'll push an update today with a small change and it should resolve that error.
Also, Everything else is correct (Providers and Aliases)
Thank you Very Much..
waiting for Update ...
I Found A solution !
It seems Err: " cURL error 60 " Is a Common Err Specially for Windows Users :
To solve the Err you need to do these steps :
Oh i see. Ok!
Guzzle cURL uses OS cert by default. Another insecure solution was to disable verify. Anyway, Thanks for sharing the solution. Maybe I'll disable verify or add a note for windows users.
Hi, I get this error Class 'App\Http\Controllers\Telegram' not found when i use the Telegram:: class
I have added Telegram as an alias in config
Most helpful comment
I Found A solution !
It seems Err: " cURL error 60 " Is a Common Err Specially for Windows Users :
To solve the Err you need to do these steps :
C:\wamp\bin\apacheApachex.x.x\binphp.ini
C:\wamp\binphpphpx.x.xxphp.ini
5.Enjoy Not getting Err