[Ajuda] Como converter um parametro http
#1

http://www.*******inmp3.com/fetch/?f...?v=i62Zjga8JOM

abrindo esta pagina vc pode ver que tem 3 linhas deste API
Код:
Title: Happy Forever Alone Day (Forever Alone Song) 
Length: 125 
Link: http://www.*******inmp3.com/download/get...6w3Q%3D%3D
quero criar algo (alguma) coisa que faзa pegar esse ultimo link da pagina com formataзгo. Alguem pode dar um sinal?

Achei esta public: base Dayvison Include
Код:
public *******Response(playerid, response, data[])
{
	if(response == 200)
	{
		if(strfind(data, "No video was found") != -1 || strfind(data, "<meta http-equiv=") != -1)
		{
			#if defined OnPlay*******Url
				OnPlay*******Url(playerid, "\0", 0, -1);
			#endif
			return;
		}
		new
			title[60],
			len[5],
			Find
		;
		Find = strfind(data, "<br/>");
		strmid(title, data, 7, Find-1);
		strdel(data, 0, Find+5);

		Find = strfind(data, "<br/>");
		strmid(len, data, 8, Find-1);
		strdel(data, 0, Find+11);

		strpack(*******_title[playerid], title);
		*******_len[playerid] = strval(len);

		PlayAudioStreamForPlayer(playerid, data, *******_posX[playerid], *******_posY[playerid], *******_posZ[playerid], *******_distance[playerid], *******_usepos[playerid]);
		#if defined *******_USE_TEXTDRAW
			PlayerTextDrawSetString(playerid, *******_textdraw[playerid], title);
			PlayerTextDrawShow(playerid, *******_textdraw[playerid]);
			print("Show");
		#endif
		#if defined USE_TIMER
		*******_timer[playerid] = SetTimerEx("intern_OnStopUrl", strval(len)*1000, false, "d", playerid);
		#endif
		#if defined OnPlay*******Url
			OnPlay*******Url(playerid, title, strval(len), 1);
		#endif
	}
	else
	{
		#if defined OnPlay*******Url
			OnPlay*******Url(playerid, "\0", 0, -2);
		#endif
	}
}
mas nгo consigo entender os cуdigos
Reply
#2

Estude meu amigo, isto nгo й uma tarefa simples,
necessita de um conhecimento abrangente, ou algumas semanas de pesquisa...


Vocк tem quer ter conhecimentos em: PHP, APIґs, REDES (BASICO), a funзгo HTTP, e ser experiente em pawn!
Reply
#3

eu sei '-'
Reply
#4

Код:
#include a_http

CMD:lt(playerid)
{
    HTTP(playerid, HTTP_GET, "www.*******inmp3.com/fetch/?format=text&video=http://www.youtube.com/watch?v=i62Zjga8JOM", "", "YT_HttpResponse");
	return 1;
}

forward YT_HttpResponse(playerid, response, data[]);
public YT_HttpResponse(playerid, response, data[])
{
    if(response == 200) //Sucesso (site retornou uma resposta)
    {
        new pos = strfind(data, "http://", true); //retornar posiзгo inicial do texto "http://"
        if(pos != -1) //se houver resultados
        {
            PlayAudioStreamForPlayer(playerid, data[pos]); //tocar o link data a partir da posiзгo encontrada
        }
    }
	return 1;
}
Reply
#5

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
Код:
#include a_http

CMD:lt(playerid)
{
    HTTP(playerid, HTTP_GET, "www.*******inmp3.com/fetch/?format=text&video=http://www.youtube.com/watch?v=i62Zjga8JOM", "", "YT_HttpResponse");
	return 1;
}

forward YT_HttpResponse(playerid, response, data[]);
public YT_HttpResponse(playerid, response, data[])
{
    if(response == 200) //Sucesso (site retornou uma resposta)
    {
        new pos = strfind(data, "http://", true); //retornar posiзгo inicial do texto "http://"
        if(pos != -1) //se houver resultados
        {
            PlayAudioStreamForPlayer(playerid, data[pos]); //tocar o link data a partir da posiзгo encontrada
        }
    }
	return 1;
}
Obrigado, thanks very much guy.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)