Go Back   Free website templates > Web Template Help > PHP and MySQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to download all the free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-22-2009, 12:25 PM
vareside's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 254
vareside is on a distinguished road
Question URL Shortener Services

Hey folks,

I'm trying to create a form for my website where users are able to short their URL's using one out of many different services. The form shall be like that: First a drop down menu to choose a service, then a text field to enter the long URL and then a "GO!" or "CUT IT!" button. I have already the API code for U.NU, so I just need the form coding but to let PHP handle that form. But how?

Here the PHP API code from U.NU:
PHP Code:
$original_url 'http://www.vareside.com/';
$request 'http://u.nu/unu-api-simple?url=' urlencode($original_url);
$response file_get_contents($request);
if (
substr($request04) == 'http')
{
   echo 
"Shortened URL = $response";
}
else
{
   list (
$error_code$error_message) = explode('|'$response);
   echo 
"Error = $error_message ($error_code)";

I hope someone can help me as fast as possible.
Thanks to all of you!
Reply With Quote
  #2 (permalink)  
Old 08-01-2009, 05:48 PM
bmcoll3278's Avatar
Moderator
 
Join Date: Jun 2009
Posts: 294
bmcoll3278 is on a distinguished road
Default

I am not sure with a api I use a php file to write a folder create a index.html in the folder and the index file is a redirect with the correct url. then the link is printed out by the file as well. that way my long urls are short and friendly. if you have a short url you could offer the service yourself this way.
__________________
I hope to build a site with something for every body
www.bmcoll.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:04 PM.



mouseover mouseover mouseover