What's wrong with this simple PHP script?
I’m trying to make a simple page that uses the TinyURL API to generate a short URL, but something is going wrong. No matter what I do, I’m getting the same error every time. I’m suspecting it may be a host-related issue, or maybe even an error on TinyURL’s side? The error is “Unexpected T_VARIABLE at line 6.” I’m hosting with GoDaddy. Is there something I need to configure? I’m not sure what the deal is, but please take a look, here’s the code:
<?php
$long = $_POST[‘long_url’];
function shorten($the_long_url) {
$short = file_get_contents(‘http://tinyurl.com/api-create.php?url=’.$the_long_url);
return $short;
}
echo (shorten($long));
?>
Observing members:
0
Composing members: 0
Composing members: 0