Closed leandroprz closed 5 years ago
Hey there, what did you try? Give me some context and I'll try and help out.
I uploaded the folder Patreon and all the files and subfolders to my FTP.
Then I created a php file and added the code you put in the readme file, like this:
<?php
// Get Patreon posts
$patreon = new \daemionfox\Patreon\Feed("leandroprz");
$posts = $patreon->getPosts();
print_r($posts);
?>
When I try to access that php file at domain.com/phpfileicreated.php
I get error 500.
Okay, so. I just popped this into my local server:
<?php
require_once(__DIR__ . "/../vendor/autoload.php");
// Get Patreon posts
$patreon = new \daemionfox\Patreon\Feed("leandroprz");
$posts = $patreon->getPosts();
print_r($posts);
And it responded with a lot of post data. So, my question is. Did you do your require/includes at the start? If you're using composer, you need to include vendor/autoload.php
If not, you need to include the Feed.php as well as the other files.
Thank you, I made a bit of progress. This is my file now:
<?php
require_once(__DIR__ . "/Patreon/PatreonRSS.php");
require_once(__DIR__ . "/Patreon/Feed.php");
require_once(__DIR__ . "/Patreon/Components/AbstractComponent.php");
require_once(__DIR__ . "/Patreon/Components/Campaign.php");
require_once(__DIR__ . "/Patreon/Components/Post.php");
require_once(__DIR__ . "/Patreon/Components/User.php");
// Get RSS feed
$patreon = new \daemionfox\Patreon\Feed("leandroprz");
$posts = $patreon->getPosts();
print_r($posts);
?>
That works perfectly. But when trying to use the RSS feed with
// Get RSS feed
$patreon = new \daemionfox\Patreon\Feed("leandroprz");
$rss = $patreon->rss();
echo $rss;
I'm getting this error:
Fatal error: Uncaught Error: Class 'LSS\Array2XML' not found in D:\Software\laragon\www\patreon\Patreon\Feed.php:170 Stack trace: #0 D:\Software\laragon\www\patreon\leandroprz.php(12): daemionfox\Patreon\Feed->rss() #1 {main} thrown in D:\Software\laragon\www\patreon\Patreon\Feed.php on line 170
Okay, so, at this point I think you need to check out composer at https://getcomposer.org/
This will simplify your problem a lot.
Follow the instructions for downloading composer, do a "composer init" (it will walk you through the steps), and when it comes time to define your requirements, add daemionfox/patreon-rss
After that, do a "composer install" to get everything downloaded properly.
Drop me a line at matt@rcsipublishing.com if you get stuck. I'm watching this thread but for some reason I'm not getting alerted when there's a reply.
I got it working! Thank you!!
Glad you were able to get things working. Happy coding!
Hi. I'm not sure how to use this.
Where do I need to put the code you mention in the readme file?
Thank you.