Visa ett inlägg
Oläst 2010-01-15, 11:22 #2
grinditwp grinditwp är inte uppkopplad
Flitig postare
 
Reg.datum: Mar 2008
Inlägg: 320
grinditwp grinditwp är inte uppkopplad
Flitig postare
 
Reg.datum: Mar 2008
Inlägg: 320
Citat:
Ursprungligen postat av allstars Visa inlägg
htk i http://tiny.pl/htk refererar väl till en rad i en databas, antar jag så det går inte att "räkna ut" med hjälp av php på din egen server.

edit: jag tänkte nog inte tillräckligt länge innan mitt svar :P

du vill alltså ha en egen funktion som gör samma som untinys api?
Precis... men jag lyckades Det var lättare än jag trodde.
Här är källkod om någon vill ha:

PHP-kod:
function unTiny($url){
    
$success false;
        
//Hämta och följ eventuell Location
    
do {
        
$header['Location'] = '';
        
$header get_headers($url1);
        if(
$header['Location'] != ''){
            
$url $header['Location'];
            
$success true;
        }
    } while(
$header['Location'] != '');
    
    if(!
$success){
                
//Hittade vi ingen Location testa location
        
do {
        
$header['location'] = '';
        
$header get_headers($url1);
        if(
$header['location'] != ''){
            
$url $header['location'];
            
$success true;
        }
        } while(
$header['location'] != '');
    }
    return 
$url;
}
echo 
unTiny('http://tiny.pl/htk'); //Skriver ut http://www.google.com 
grinditwp är inte uppkopplad   Svara med citatSvara med citat