Download the PHP package swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify without Composer
On this page you can find all versions of the php package swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
More information about swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
Files in swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
Package mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
Short Description Checks if at https://cestina-pro-cizince.cz/trvaly-pobyt/a2/online-prihlaska/ are free spots and notifies
License MIT
Homepage https://github.com/swayoleg/mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
Informations about the package mvcr-trvaly-pobyt-lang-exam-online-prihlaska-notify
What is it project for?
In Czech republic to get permanent visa you need to get language exam. And there is a big problem to get term and register - they have always no spots. To get a spot for lang exam you need to go here https://cestina-pro-cizince.cz/trvaly-pobyt/a2/online-prihlaska/
So what I did its just simple parser that checks free spot and notifies you.
Notification and script options
The notification can be done via telegram, email and webhook. There is two type(styles I would say) to solve the problem. In noOOPJustForFunExample.php you just put the telegram token and chat id - and put the script on a cron. This is my style to solve one-time issues - just get it done.
BUT its not a cool and corporate style - right? So real "for fun" was to create script that can send notification with different type, can operate via guzzle or curl by config, can be extended - bla bla bla.
Installation
Composer
Coffee
If you want to by me a coffee - just do it:
Usage
I like to use it like this
where config.php looks like this - config_example.php
Or use the parser_example.php
So if you are novice in this lets go with config. Use parser_example.php file.
If you need to send notification to your BE with webhook use this config:
It will send simple GET request to your url with urlEncoded 'message' GET param.
Telegram notification sending
If you need to send it via telegram - create bot with @BotFather. telegram bot.
Get your token.
It will be right after this line
Use this token to access the HTTP API:
To get your int id of telegram the fastest way is to write to @userinfobot. It will respond like this:
In the nnnnnnnn place you will get your chat Id for config.
So set config like this:
If your file_get_contents function is allowed to open urls you can use
'downloader' => 'file'
as an option. Other options are curl or guzzle.
Other Options:
url - the actually url for parsing
errorMessage - what should we send if xPath didnt find any links. Works only with sendNotificationIfNoElementsFound = true
sendNotificationIfNoElementsFound - flag if we need to send message if parser cant find the links at all (I mean document structure might be changed)
domParser - leave it for now. If you want another parser add it to src/Dom and implement Swayoleg\CestinaCheck\Dom\ParserInterface
downloader - if you use file it uses simple file_get_contents php function - so url open should be allowed. curl uses ext-curl and guzzle use guzzlehttp/guzzle package
noTermsText - Text on the btn which means that there is no terms. Array param from 1.0.1 version
Multiply notifications
Yes it works. You can use webhook email and telegram notification types same time, and multipy urls, chats and emails as well.
ChangeLog
1.0.1 noTermsText param changed from string to array