Search code examples
phpvariablessimplepie

Create and include a variable in SimplePie (PHP)


Within the code below, how do I set VAR as some variable and then include it within the SimplePie code as the feed URL? The "feed" code is from the Simplepie PHP libary.

<?php

$VAR = "http://website.com/feed/";

$feed1 = new SimplePie();
$feed1->set_feed_url('$VAR'); 
$feed1->init();

?>

Solution

  • I m not sure about Simple Pie. But if you use single quotes it wont be processed. Try double quotes or better you dont need any quotes for that. Try this :

    $feed1->set_feed_url($VAR);