?
Solved

easy url shortening

Posted on 2009-04-16
32
Medium Priority
?
536 Views
Last Modified: 2012-05-06
i need a url shortening code for lix.in or ilix.in
i need one text box in page1 where i give all the big links each per line and press submit
it should automatically convert all of them to short url's of lix.in or ilix.in and get the output in same text box
0
Comment
Question by:blaaze
  • 12
  • 11
  • 8
  • +1
32 Comments
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157275
Hi blaaze,

this project is a thing which costs approx. 30 to 45 minutes to develop. I c'd program it for you for less money.
I'll send you an e-mail.

Kind regards,
Henning
0
 
LVL 4

Author Comment

by:blaaze
ID: 24157352
sorry boss i need it for educational purposes not commercial
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157447
Here is a start:

LIX.IN provides already such an interface: http://lix.in/more.php
<form method="POST">
<textarea name="links" rows="10"></textarea>
<input type="submit" name="submit" value="Encrypt links" />
</form>
 
<?php
if(isset($_POST["links"])) {
$link_array = explode("\r\n", $_POST["links"]);
 
for($link_array as $link) {
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://lix.in/");
curl_setopt($ch, CURLOPT_HEADER, 0);
 
#Set the Parameters correct
#Search in answer for text-field
 
}
 
}

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

by:blaaze
ID: 24157588

Parse error: parse error, expecting `';'' in C:\xampp\htdocs\xampp\reval.php on line 10
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157608
Hi blaaze,

please post your complete file. I'll see what I can do for you.

Kind regards,
Henning
0
 
LVL 4

Author Comment

by:blaaze
ID: 24157648
i worked on ur code only
it is showing that error
please understand the concept i need to have the same interface as lix.in/more.php but i need the code to embed in my page so im asking it
and the output should generate the links from the lix.in and show me on my page
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157734
Styr lige dine e-lancing tendenser, Henning. De er i strid med EE reglerne
0
 
LVL 4

Author Comment

by:blaaze
ID: 24157747
sorry mplungian i cant understand ur words
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157774
He says,

that I am not allowed to post advertisings, that I write your code for money.

Kind regards,
Henning
0
 
LVL 4

Author Comment

by:blaaze
ID: 24157810
if money matters then i wont need the code
i already mentioned it
it is purely for the educational purposes and i need it very urgently
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157828
It was a comment to Henning.

Seems lix.in needs the referrer set too...
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157840
Hi blaaze,

thats the matter. I am not allowed to post that.
I'll give you a code within 1 hour, which should work.

Kind regards,
Henning
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157847
This did not work, so I wonder if you can set the referrer using curl



<form action="http://lix.in/index.php" method = "POST" target="if1">
<input type="text" name="url" size="40" style="font-family: Tahoma; font-size: 8pt" value=""><input type="submit" value="Protect Link" name="button" style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF">
<input type="reset" name="reset" value="Clear" style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF">
<input type="hidden" name="op" value="crypt_single">
<input name="captcha" type="hidden" value="0" />
<input type="submit" name="mode" value="Captcha Off" style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF">		
</form>
<iframe name="if1" frameborder="none"></iframe>

Open in new window

0
 
LVL 4

Author Comment

by:blaaze
ID: 24157876
it is giving the same output as input
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157895
I know. I said it did not work - e.g. the site does not allow direct loading from another site. So whoever tries this will need to set the referrer or perhaps ask for an API
0
 
LVL 4

Author Comment

by:blaaze
ID: 24157926
else try for ilix.in
or urlteam.org
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157927
Hmm

Seems to be a bug

They have this

http://lix.in/webmaster.php

and it does the same thing, loads their site with the field filled in
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24157941
Hi, I tried it and it works for me:

http://www.mdorf.info/test.php

I got the encoded url in the frame.

Kind regards,
Henning
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24157998
Okee.

Also works here



          <form method='POST' action="http://ilix.in/">
    <input type='hidden' name='captcha' value='0'>
    <input type='hidden' name='pass' value=''>
    <input type='hidden' name='multiple' value='0'>
    <input type='hidden' name='folder' value='0'>
    <input type='hidden' name='cont' value=''>
 
        <input type='text' name='link' size="65" value=''><br />
    	<input type='submit' name='submit' value='Protect Link' style="font-family: Tahoma; font-size: 8pt; border-left-style: solid; border-left-color: #B0D678; border-left-width:10px; background-color:#EEDDFF;
   border-top-style: solid;
   border-top-color: #B0D678;
   border-top-width: 1px;
   border-bottom-style: solid;
   border-bottom-color: #B0D678;
   border-bottom-width: 1px;
   border-right-style: solid;
   border-right-color: #B0D678;
   border-right-width: 1px;"> 
    <input type='reset' name='submit' value='Clear' style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF"> 
    <input type='submit' name='submit' value='Captcha Off' style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF"> 
    <input type='submit' name='submit' value='Multiple Off' style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF"> 
    <input type='submit' name='submit' value='Enable Password Off' style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF"> 
	<input type='checkbox' name='cont' style="width=17px; height=17px; vertical-align: middle; color: #000000; border: 1px solid #000000; background-color: #FFFFFF"><a href="" ONMOUSEOVER="popup('If this box is <b>TICKED</b>, website will be redirected <b>DIRECTLY</b> without the \'Continue\' Button.','white')"; ONMOUSEOUT="kill()"><font face="Tahoma" size="1" color="red"><u>?</u></font></a> 
	    </form>

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24158011
Can you curl that?

And is it not copyright infringement?
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24158041
It's very easy to curl that.
But bear in mind, if this is not already enough for the creator of that question.

If it is needed I'll write you the curl parameters asap.

Kind regards,
Henning
0
 
LVL 4

Author Comment

by:blaaze
ID: 24158085
@mplungian i think ur code is working but can u please get the things as per my need ,
i asked to have only one textbox which can take multiple links in it(each per line)
and it shortens the links and displays in the same box without redirecting to anyother page

and only one plain submit button is allowed
i think u need to curl it
0
 
LVL 4

Author Comment

by:blaaze
ID: 24158096
please both u send ur email ids now
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24158688
Hi,

I am finished.

http://www.mdorf.info/test.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
</head>
 
<body>
 
<?php
if(isset($_POST["button"])) {
	$ch = curl_init("http://lix.in/more.php");
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_NOPROGRESS, false);
	curl_setopt($ch, CURLOPT_POSTFIELDS, "op=crypt_multiple&captcha=0&folder=0&button=Protect%20Links&url=".$_POST["url"]);
	
	$res = curl_exec($ch);
	curl_close($ch);
	
	$start = strpos($res, "<textarea name=\"url\" rows=\"11\" cols=\"45\">");
	$ende = strpos($res, "</textarea>");
	
	$urls = substr($res, $start+42, $ende-$start);
	$array = explode("\r\n", $urls);
 
}
?>
<form method="POST">
<textarea name="url" rows="11"><?php if(isset($array)) { foreach($array as $entry) { echo trim($entry)."\r\n"; }} ?></textarea><input type="submit" value="Protect Link" name="button" style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF">
</form>
 
</body>
</html>

Open in new window

0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24158847
One more information: If you want to submit only ONE URL via the script, you'll have to make, a break with return to get the url encoded. If you don't do a line break, you'll get the error "please enter maximum 60 lines minimum 1".

Yours
Henning
0
 
LVL 4

Author Comment

by:blaaze
ID: 24158878
ah i cant work in this , plz give ur mail id so that i can contact u for further
0
 
LVL 3

Expert Comment

by:HMoellendorf
ID: 24158949
Try to enter 2 URLs, I'll contact you via mail.
Or do you have MSN?
0
 
LVL 4

Author Comment

by:blaaze
ID: 24159335
@hmoellendorf

plz give me a reply
0
 
LVL 4

Author Comment

by:blaaze
ID: 24159421
@hmoellendorf

please post the code of http://www.mdorf.info/test.php

here now, so that i can grant u the points
0
 

Expert Comment

by:sandeepis2006
ID: 24159584
can anyone get this code, i also need it ,

http://www.mdorf.info/test.php

it is working very much perfect, i am also interested in it
0
 
LVL 3

Accepted Solution

by:
HMoellendorf earned 1980 total points
ID: 24159802
The solution we found out to process one AND multiple links is provided below.

Regards,
Henning
<?php
error_reporting(E_ALL);
ini_set("display_errors", true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
</head>
 
<body>
 
<?php
if(isset($_POST["button"])) {
	
	$array = explode("\r\n", $_POST["url"]);
	if(sizeof($array) == 1) {
	
		$_POST["url"] .= "\r\n";
		
	}
	
	$ch = curl_init("http://lix.in/more.php");
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_NOPROGRESS, false);
	curl_setopt($ch, CURLOPT_POSTFIELDS, "op=crypt_multiple&captcha=0&folder=0&button=Protect%20Links&url=".$_POST["url"]);
	
	$res = curl_exec($ch);
	curl_close($ch);
	
	$start = strpos($res, "<textarea name=\"url\" rows=\"11\" cols=\"45\">");
	$ende = strpos($res, "</textarea>");
	
	$urls = substr($res, $start+42, $ende-$start);
	$array = explode("\r\n", $urls);
	
}
?>
<form method="POST">
<textarea name="url" rows="11"><?php if(isset($array)) { foreach($array as $entry) { echo trim($entry)."\r\n"; }} ?></textarea><input type="submit" value="Protect Link" name="button" style="color: #000000; font-family: Tahoma; font-size: 8pt; border: 1px solid #000000; background-color: #FFFFFF">
</form>
 
</body>
</html>

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24159990
Guys - for the future. It is Experts Exchange - so please leave your emails in your profiles

Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question