PHP code example of ssitdikov / telegraph-api-client
1. Go to this page and download the library: Download ssitdikov/telegraph-api-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ssitdikov / telegraph-api-client example snippets
$telegraph = new TelegraphClient($client);
$account = new Account();
$account->setShortName('Test.Account');
try {
$account = $telegraph->createAccount(
new CreateAccountRequest($account)
);
catch (\Exception $e) {
// ...
}
$page = new Page();
$page->setTitle('Test article');
$page->setAuthorName( $account->getAuthorName() );
$link = new LinkType();
$link->setHref('https://github.com/ssitdikov');
$link->setText('Salavat Sitdikov github`s page');
$image = new ImageType();
$image->setSrc('https://telegram.org/file/811140775/1/Pc_4R_013Ow.144034/1c1eeaa592370d0b93');
$page->setContent([$link, $image,]);
$page = $telegraph->createPage(
new CreatePageRequest($page, $account)
);