hey guys I want to add <?php echo $_GET["q"]; ?> PHP: instead of "news" in this PHP code <?php $rss = new DOMDocument(); $rss->load('http://wordpress.org/news/feed/'); ?> PHP: How can I do that Thank you for help
$rss = new DOMDocument(); $rss->load( $_GET['q'] ); Code (markup): Unless you meant that literally, in which case: $rss = new DOMDocument(); $rss->load( "http://wordpress.org/{$_GET['q']}/feed/" ); Code (markup):
$url = "http://wordpress.org/".$_GET['q']."/feed/"; $rss = new DOMDocument(); $rss->load($url ); PHP:
Are you sure you don't have $rss->load( 'http://wordpress.org/{$_GET['q']}/feed/' ); Code (markup): or $rss->load( "http://wordpress.org/{$_GET["q"]}/feed/" ); Code (markup): Neither of those will work.
is it a $_GET method? whatever format they're using maybe you're not catching it right? $_GET['q'] looks like something that works in AJAX script but I don't know about rss as I found it to be junky and clunky on site. If you want content you're better of having an A.I. script read articles and re-arrange the article by rule sets/filters. Then its unique content according to Google bots. Unless you make the A.I. program smart enoughto recognize words/and english language rules of verb/noun etc. I'm slowly making one of those you can see the test I ran for it to identify words/slangs/expressions here http://reneeweedon.com/AI/AI.php If you want it I can sell a copy of the program where I have it now in identifying words by separating them by white space and identifying them individually by noun/verb etc to derive meaning from a sentence by English language filter rules. You can modify it since its in PHP. Eventually I want it to make entire websites by asking it to do so. With long term goal of setting a billion AI loose on Internet to work as a billion/multi-billion computer teams 24-7. I'd also like it to learn every program language and be able to make me high-end programs to use/sell. AI making software. who knows what it can do long term since it reads English language now.
No offense guys, but why the devil are you making a simple string addition so blasted complicated?!? Of course wasting double quote overhead then dicking around with curly brackets for christmas only knows what is some real head scratching nonsense. Oh wait, PHP developers...(and turdpress too!) gotta do EVERYTHING the hard way. Ogah had it 'right', though was wasting an extra variable on it... <?php $rss = new DOMDocument(); $rss->load('http://wordpress.org/'.$_GET['q'].'feed/'); ?> Code (markup): Should be all it needs... Though ogah may have been correct in that it probably should be in a var -- but that would be to sanitize, check for validity, etc, etc... since user input ($_GET, $_POST, etc) should ALWAYS be treated as if it's got gonorrhea.
Honestly, it's all a matter of preference. I typically prefer to use the bracket method when my final string is joining a bunch of variables together, as in my opinion it makes it much more readable. NOTE: This only applies when the variables aren't array members, but rather short names. Yes, technically speaking, the method you posted is going to be slightly better performance wise; but realistically, the difference is going to be neglible unless you're doing hundreds/thousands of replacements. Different strokes for different folks. And yes, totally agree as to the sanitizing input aspect.