title: PHP - securing parameters passed in the URL
body: <p>I have an application which makes decisions based on part of URL:</p>
  
  <pre><code>    if ( isset($this-&gt;params['url']['url']) ) {
      $url = $this-&gt;params['url']['url'];
      $url = explode('/',$url);
      $id = $this-&gt;Provider-&gt;getProviderID($url[0]);
  
      $this-&gt;providerName = $url[0]; //set the provider name
  
      return $id;
  
      }
  </code></pre>
  
  <p>This happens to be in a cake app so $this->params['url'] contains an element of URL. I then use the element of the URL so decide which data to use in the rest of my app. My question is...</p>
  
  <p>whats the best way to secure this input so that people can't pass in anything nasty?</p>
  
  <p>thanks, </p>