[Pedido] Nome da musica ao inves de url
#6

Arquivo PHP:
PHP код:
<?php
    $pesquisa 
str_replace(' ''+'$_GET['q']);
    
$musica file_get_contents('http://search.4shared.com/q/CCQD/1/music/' .$pesquisa);
    
$pos strpos($musica"showMediaPreview(event, '") + 25;
    
$resto strpos($musica"/preview.mp3") + 12;
    
$link substr($musica$pos$resto-$pos);
    echo 
$link;
?>
Script:

pawn Код:
#include <a_http>

forward PlayAudioStreamByName(playerid, name[]);
forward PlayAudioStreamByNameEx(index, response_code, data[]);

public PlayAudioStreamByName(playerid, name[])
{
    for(new i; i < strlen(name); i++) {
        if(name[i] == ' ') name[i] = '+';
    }
    new str[160];
    format(str, 160, "127.0.0.1:8080/SAMP.php?q=%s", name);
    HTTP(playerid, HTTP_GET, str, "", "PlayAudioStreamByNameEx");
    return 1;
}

public PlayAudioStreamByNameEx(index, response_code, data[])
{
    if(response_code == 200) return PlayAudioStreamForPlayer(index, data);
    return 1;
}

CMD:tocar(playerid, params[])
{
    new M[20];
    if(sscanf(params, "s[50]", M)) return SendClientMessage(playerid, -1, "Use /tocar [Nome da Mъsica");
    PlayAudioStreamByName(playerid, M);
    return 1;
}
[ame]http://www.youtube.com/watch?v=GRqwVQtj2OQ[/ame]
Lembre-se de alterar no format, o link para o arquivo PHP que vocк hospedou.

Gambiarra wins again! Abraзos
Reply


Messages In This Thread
Nome da musica ao inves de url - by SonicFreeStyle - 23.08.2014, 16:36
Re: Nome da musica ao inves de url - by Bruno13 - 23.08.2014, 16:40
Re: Nome da musica ao inves de url - by Pocahontas - 23.08.2014, 21:32
Re: Nome da musica ao inves de url - by Wakayama - 24.08.2014, 01:58
Re: Nome da musica ao inves de url - by n0minal - 24.08.2014, 04:24
Re: Nome da musica ao inves de url - by Dolby - 24.08.2014, 06:57
Re: Nome da musica ao inves de url - by SonicFreeStyle - 24.08.2014, 09:55

Forum Jump:


Users browsing this thread: 1 Guest(s)