KonstantinKuklin / livejournal-php-sdk

MIT License
0 stars 2 forks source link

No sample example to fetch and post #1

Open DhirajBelure opened 6 years ago

DhirajBelure commented 6 years ago

Please, give the example of fetch and post record/data from livejournal.

KonstantinKuklin commented 6 years ago

I implemented only fetching ability. How to get 30 posts of lifejournalNameToFetch:

$liveJournalClient = new Client($YourLivejournalUserName, $YourLivejournalPassword);
$postDtoList = $liveJournalClient->fetchRecentPosts('lifejournalNameToFetch', 30, $anotherOptions);

$anotherOptions can be empty, but if u want to get next 30 posts, u need to set data from which u need to start searching :

$anotherOptions['beforedate'] = $lastPostDto->createdDate;
DhirajBelure commented 6 years ago

**my code*** require('src/LiveJournal/Client.php'); use LiveJournal;// getting warning

var_dump(file_exists("src/LiveJournal/Client.php"));//boolean(true); my path is right

$params = array( 'userName' => '',//username of login livejournal 'passwordHexed' => '' //password of login livejournal );

$liveJournalClient = new Client($params['userName'],$params['passwordHexed']);// getting error on this line. print_r($liveJournalClient);exit();

$postDtoList = $liveJournalClient->fetchRecentPosts('lifejournalNameToFetch', 30, $anotherOptions);


getting error on my page . I have include client.php the for client class and I m working on localhost server.Please. check below error

Warning: The use statement with non-compound name 'LiveJournal' has no effect in /media/medusa/Backup/htdocs/livejournalmaster/livejournalsample.php on line 10

Fatal error: Uncaught Error: Class 'Client' not found in /media/medusa/Backup/htdocs/livejournalmaster/livejournalsample.php:30 Stack trace: #0 {main} thrown in /media/medusa/Backup/htdocs/livejournalmaster/livejournalsample.php on line 30

***Client.php code*

<?php /**

use XML_RPC2_Client;

/**

KonstantinKuklin commented 6 years ago

u need to install my library throw composer - https://getcomposer.org/ require('src/LiveJournal/Client.php'); - is not enough

the path of client should be for your code: $liveJournalClient = new \LiveJournal\Client($params['userName'],$params['passwordHexed']);

DhirajBelure commented 6 years ago

*composer.json***** { "name": "konstantin-kuklin/livejournal-php-sdk", "license": "MIT", "type": "library", "description": "The \"LiveJournal\" PHP SDK", "keywords": ["php", "library", "sdk", "livejournal", "lj"], "homepage": "https://github.com/KonstantinKuklin/livejournal-php-sdk", "authors": [ { "name": "Konstantin Kuklin", "email": "konstantin.kuklin@gmail.com" } ], "autoload": { "psr-4": { "LiveJournal\": "src/LiveJournal/" } }, "require": { "pear/xml_rpc2": "dev-trunk", "pear/http_request2": "dev-trunk" } }


above json file i have downloaded .zip package.