View Full Version : Replacing long urls with is.gd shortened urls
02-07-2010, 01:31 AM
I have a variable which holds only a string, and this string may contain an unlimited amount of urls inside of it. I already have a function I put together that accepts one argument, the URL to shorten, and returns the is.gd shortened url as a string. Now, what I would like to do, is for each long URL in the original string, i would like to run that URL through my shortening function, and replace the long URL with the newly shortened URL. Sorry if it is not clear what I want, go ahead and ask questions.
02-07-2010, 10:17 AM
What I can suggest on a first look, this depends of using the next two php function: explode (http://www.php.net/manual/bg/function.explode.php) and combine (http://www.php.net/manual/bg/function.array-combine.php).
The goal of combine is that you keep old urls as array keys and keep they unique ( if in the input some urls are used more than once ).
Hope it helps!
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.