I am given a page url like 'http://abc.com/test.php?a=1&b=2&c=3'. Now I have been told to change the value of b to 5 so that it becomes 'http://abc.com/test.php?a=1&b=5&c=3'.
i.e change from http://abc.com/test.php?a=1&b=2&c=3 to http://abc.com/test.php?a=1&b=5&c=3
The remaining parts from the first step (protocol, host, path...) to re-build the full URL or - if you have the HTTP pecl extension - a http_build_url() with HTTP_URL_JOIN_QUERY will alleviate much of the work.
Since this question is closed, but getting a lot of traffic, I thought it useful to mention that Pear has a class that handles all of this. See stackoverflow.com/a/33109595/3852461
– iautomationOct 13 '15 at 18:05
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.