I am working on a code-igniter project to integrate tinyurl api. when I click submit the url shows in another page. I want to display the tiny url right under the original url.
The form is---
<form class="actionForm" action="get_tiny_url">
<div class="form-group">
<label for="title"><?php _e('Url') ?></label>
<input type="text" class="form-control" id="original_url" name="original_url">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
to show the form
public function url()
{
view('url');
}
the Api for tinyurl is here---
public function get_tiny_url()
{
$original_url = $this->input->get('original_url');
function get_tiny_url($original_url)
{
$api_url = 'tinyurlApi' . $original_url;
$curl = curl_init();
$timeout = 10;
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $api_url);
$new_url = curl_exec($curl);
curl_close($curl);
return $new_url;
}
$tiny_url = get_tiny_url($original_url);
echo $tiny_url;
}
Now how do I show the tiny url right under the form?