function createTinyUrl($strURL) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.phpurl=".$strURL);
return $tinyurl;
}
echo(createTinyUrl('http://phpbuilder.com'));
What this snippet does is auto-generate a TinyUrl version of 'http://phpbuilder.com'.
Now I want to echo the output several times on the page, and
echo(createTinyUrl('http://phpbuilder.com'));
does exactly that, but since the page connects to the API "X" amount of times over and over again, this creates an UNBEARABLE page load time.
So how can I capture the output generated and store it in a variable so that whenever I want it displayed on my page I can just "echo $tinyurlvalue"?
Best Regards
~Ross Vaughn 🙂