Welcome Guest, Not a member yet? Register   Sign In
URI Get query issues - Solve it once for all
#11

[eluser]damienwjking[/eluser]
Ah, thanks for this, its very comprehensive but I realise I have not explained myself. What I am trying to do is process querys that are processed to my website.

i.e.

External Website posts to my website via a http not a form
Code:
<a href="http://www.mysite.com/controller/method/?title=DamiensTitle&url=http://www.theirsite.com/index.php">Add to my site</a>

So I need my controller/method to be able to read $title and $url as from the uri.

I tried $_GET['title'], tried uri helper with segmant(4) etc (doesn't work cause of slashes).

THe title and url are dynamic so I can never know where they start or end only via the ? or &

Is this making sense.

Sorry if again I am not being clear.
#12

[eluser]TheFuzzy0ne[/eluser]
If a Web site knows the URL, they should know the format of the URL too, no?

Firstly, if you are expecting a set number of variables. You can set your controller to expect them in that order:

Code:
function my_method($title="", $url="")
{
    ...

Then you can use a URL like this http://mysite.com/controller/method/Damien/somesite.com

Secondly, unless the Web site URL is encoded with urlencode, it will break your controller. If I recall correctly, it will break your URI whether you use use query strings or segments. That's exactly why urlencode() was created. Smile




Theme © iAndrew 2016 - Forum software by © MyBB