I have the function below to create a tiny url but what happens is that when i run it through I get the out comes with a undescore(_) all except the last output.
Example:
I input
http://sample1.com
http://sample2.com
http://sample3.com
http://sample4.com
I get
http://link.mysite.org/?1234
http://link.mysite.org/?4234
http://link.mysite.org/?3566
http://link.mysite.org/?6756
but when i check them I get linked to
http://link.mysite.org/?1234 => http://sample1.com_
http://link.mysite.org/?4234 => http://sample2.com_
http://link.mysite.org/?3566 => http://sample3.com_
http://link.mysite.org/?6756 => http://sample4.com
Notice that the last one doesn't have the underscore. So im thinking its the array causing problem.
[PHP]<?php
function tinyurl($url){
// Shortens a url
$html = file_get_contents("http://link.mysite.org/create.php?url=".$url);
preg_match('/http:\/\/link\.mysite\.org\/(.*)<\/b>/', $html, $matches);
return "http://link.mysite.org/".$matches[1];
}
$url = $_POST['multi_urls'];
$lines = explode("\n", $url);
foreach ($lines as $value){
echo tinyurl($value).'<br>';
}
?> [/PHP]
Please help.