Language: HtmlPhp
http://to./ php shortener
1: <?php 2: function search_string($start , $end , $from, $number=1){ 3: if($number<1){ 4: $number=1; 5: } 6: $from = trim(str_replace("\r\n","",$from)); 7: $i = 0; 8: $ans = $from; 9: if(!stristr($ans , $start)){ 10: return false; 11: } 12: while($i<$number){ 13: if(stristr($ans , $start)){ 14: $ans = stristr($ans , $start); 15: $ans = substr($ans, strlen($start)); 16: } 17: $i++; 18: } 19: if(strpos($ans, $end)){ 20: $pos = strpos($ans, $end); 21: $ans = substr($ans, 0, $pos); 22: } 23: if(isset($ans) && $ans != "" ){ 24: return trim(str_replace("\r\n","",$ans)); 25: }else{ 26: return false; 27: } 28: } 29: 30: $ch = curl_init(); 31: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 32: //super cool url! 33: $url="http://to./"; 34: curl_setopt($ch, CURLOPT_URL, $url); 35: 36: $query="url=".urlencode($_GET['url']); 37: curl_setopt($ch, CURLOPT_POST, true); 38: curl_setopt($ch, CURLOPT_POSTFIELDS, $query); 39: $result = curl_exec($ch); 40: $url=search_string("value=\"","\"",$result); 41: 42: echo $url; 43: ?>
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

