Jump to content

Insert a Parameter into a string?


jnich05

Recommended Posts

It doesn't throw back errors like some of the stuff I've tried, but it still doesn't work. Is it possible that this new script is pulling a feed with $full_key_word in the url instead of processing that parameter and inserting whatever it produces?

 

 

 

Link to comment
Share on other sites

Why not just replace the whole thing..

$keyword = foo;
$rssFeeds[0] = 'http://blogsearch.google.com/blogsearch_feeds?hl=en&q='.urencode($keyword).'&ie=utf-8&num=10&output=rss';

If the $rssFeeds variable does not require any extreme changes, place that after or in place of your old code.. and it'll change the keyword to what you set it as. $keyword could be set through $_GET if you wanted etc.

Link to comment
Share on other sites

The script is just a feed parser. It pulls data from an rss feed, but I'm trying to make it pull a different feed based on whatever words are made with $full_key_word. When I try running the new code you made, it just pulls back an empty feed which either means it's not working, or it's pulling back a feed for $full_key_word which there are no feed items for.

 

Is it possibly pulling this:

http://blogsearch.google.com/blogsearch_feeds?hl=en&as_drrb=q&as_qdr=d&q=$full_key_word&ie=utf-8&num=10&output=rss

 

 

Link to comment
Share on other sites

My code works fine, I tested it myself! Go to these urls..

$keyword = WHATEVER
$rssFeeds[0] = 'http://blogsearch.google.com/blogsearch_feeds?hl=en&q='.urencode($keyword).'&ie=utf-8&num=10&output=rss';

http://blogsearch.google.com/blogsearch_feeds?hl=en&q=dog&ie=utf-8&num=10&output=rss

http://blogsearch.google.com/blogsearch_feeds?hl=en&q=foo&ie=utf-8&num=10&output=rss

http://blogsearch.google.com/blogsearch_feeds?hl=en&q=wow&ie=utf-8&num=10&output=rss

 

They all work as rss, your parsing is done wrong then? What queries ARE returning something?

Link to comment
Share on other sites

I think I've figured out a few more php tidbits this weekend trying to get this to work. It turns out they all worked, and I'm now using the code by asmith.

 

I'm not sure how to explain why it didn't work at first, but it had something to do with not liking any parameters I was using in it. It worked perfectly when I used non-parameter words in the script, but eventually got it working by using a different parameter.

 

Much thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.