0

We are not able to strip the particular parameters in URL, please look at the URL.

http://www.globalseopulse.com/&sa=U&ei=u7RWUJniFcfTrQejp4DACw&ved=0CBMQFjAA&usg=AFQjCNEWLiKXbuVg6N165ETGYP3F1K0Qfw

In our code, it automatically adds the parameters:

&sa=U&ei=u7RWUJniFcfTrQejp4DACw&ved=0CBMQFjAA&usg=AFQjCNEWLiKXbuVg6N165ETGYP3F1K0Qfw

We do not need these parameters in our program. Please provide me the suitable method in which we can remove the additional parameters within the loop .

Thanks

PPS

Chris Moutray
  • 18,029
  • 7
  • 45
  • 66
PPS
  • 7
  • 5
  • Possibly a dupe of [Beautiful way to remove GET-variables with PHP?](http://stackoverflow.com/questions/1251582/beautiful-way-to-remove-get-variables-with-php) and [Strip off URL parameter with PHP](http://stackoverflow.com/questions/4937478/strip-off-url-parameter-with-php) – Sepster Sep 17 '12 at 05:38
  • 1
    please check the URL, it's not having "?" in the URL. – PPS Sep 17 '12 at 05:43
  • OK, have added string-manipulation- (rather than URL manipulation-) based answer. – Sepster Sep 17 '12 at 05:53

1 Answers1

0
$url = "http://www.globalseopulse.com/&sa=U&ei=u7RWUJniFcfTrQejp4DACw&ved=0CBMQFjAA&usg=AFQjCNEWLiKXbuVg6N165ETGYP3F1K0Qfw";
$pieces = explode("&", $url, 1);
$urlWithoutParameters = $pieces[0];
Sepster
  • 4,800
  • 20
  • 38
  • it's ok, but that's not a right for everytime. if we have a already parameter in the URL then our this script is not giving the right data. like if our URL will be "www.globalseopulse.com/resources.html?a=somevalue&sa=U&ei=u7RWUJniFcfTrQejp4DACw&ved=0CBYQFjAB&usg=AFQjCNF_y6UlnnjEZwniTcOsA0etbcAp3Q" then we are not able to remove this "&sa=U&ei=u7RWUJniFcfTrQejp4DACw&ved=0CBYQFjAB&usg=AFQjCNF_y6UlnnjEZwniTcOsA0etbcAp3Q" – PPS Sep 17 '12 at 06:10