English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to send this url:
http://news.google.com/?ned=us&topic=b&output=rss as a variable inside of another url (i can't copy the actual URL i'm trying to make cause it shows up as a link in here and its not all displayed). The problem is everything after the first & is assigned a variable and not left intact (as it should do, but not what i want). I tried putting that in single quotes but that result can only be described as strange. I'm not really sure what else to do, any help is greatly appreciated.

If you want to see the error here is the link:
http://globalnewsnow.info/news.php?page=link&url=http://news.google.com/?ned=us&topic=b&output=rss&ref=bis

I'm using MagpieRSS for the rss parsing if it matters.

2006-07-26 07:52:23 · 4 answers · asked by Brady 3 in Computers & Internet Programming & Design

4 answers

The "&" is causing the problem in the URI ...
When you use $_GET to get url value, it retrieves the url string till it faces the first "&" in http://news.google.com/?ned=us&topic=b&output=rss&ref=bis ...

To solve this, you can replace "&" in http://news.google.com/?ned=us&topic=b&output=rss&ref=bis with something link "*!*" (whatever you want) and then place it inside of another url, target of a button or whatever ... and after you retrieved the url using $_GET in news.php, replace the used symbol with the original one "&".

2006-07-26 08:04:45 · answer #1 · answered by Anonymous · 1 0

it truly is termed utilising the querystring, or the GET technique (as antagonistic to the positioned up technique the position variables are despatched "invisibly" and under no circumstances displayed interior the URL). utilising the GET technique might want to be very sensible now and again, yet really do no longer use it for any significant or senstitive records b/c of route it isn't any longer take care of to have the records displayed interior the URL. however, one earnings of the GET technique is that you may demonstrate "custom" pages counting on what the GET variables are set to, and those pages might want to be bookmarked - or in different words a special URL exists for each custom web page. you won't be able to attempt this with pages that get variable records utilising the positioned up technique. the position to study i recommend learning particularly of Hypertext Preprocessor - only google "Hypertext Preprocessor GET technique" or some thing like that and also you should discover some loose tutorials explaining issues. The website can must be a Hypertext Preprocessor web page so as that the Hypertext Preprocessor scripting can procedure/get/understand the coaching interior the URL. Very accessible aspect!

2016-11-26 01:08:58 · answer #2 · answered by ? 4 · 0 0

try

http://globalnewsnow.info/news.php?page=link&url=http://news.google.com/%3Fned=us%26topic=b%26output=rss%26ref=bis

this works
actually what i did is changed the ? to %3F and & to %26

If you want to keep the & and ? in the url the you can try to use $_SERVER['QUERY_STRING'] to get the full query string and the parse it.

2006-07-26 08:11:39 · answer #3 · answered by cool_guy 2 · 0 0

PHP's urlencode and urldecode are the easiest. If for whatever reason that doesn't work, I would just run a regex that replaces "&" with "[AND]" (because that should be the only thing conflicting).

2006-07-26 08:05:37 · answer #4 · answered by geofft 3 · 0 0

fedest.com, questions and answers