1

If I know what vars I can have in my URL how do I validate my URL and ignore the ones that aren't on my list?

I suppose I will have all 'good' vars in an array

$good = array("name", "car", "year", "color"); 

Then I need to get the request URL, then break it apart looking for QUERY elements and loop those against my $good array, strip the ones that don't belong and process request. Seems like a good plan in theory. Or is there a better plan? If it's OK, how do I do all that?

$url = http://mydomain.com/?car=1&color=red&bad=asdasd 

1 Answer 1

1

Try use this: http_build_query.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.