Translation of text using HTTP_GET and ****** translate
#1

Hi i am editing a script called iTranslate and i am trying to get it to work with the inbuilt HTTP system rather that pwncurl, but i cant seem to get it to work :S
I feel there isnt enough information about the new HTTP system available.

pawn Код:
forward Inter_SendClientMessage(playerid,color,msg[]);
forward translate(playerid,string[],fromplayer);
forward iTranslate_OnPlayerConnect(playerid);
new ppl_ip[MAX_PLAYERS][32],cntryname[MAX_PLAYERS][128],preppp,preppp2,url[255];
new gettranslation[2048];
new sendtranslation[2048];
new rawdata[120000];
public iTranslate_OnPlayerConnect(playerid)
{
    GetPlayerIp(playerid,ppl_ip[playerid],32);
    GetCountryCode(ppl_ip[playerid], cntryname[playerid], 128);
//  printf("ID %d comes from %s",playerid,cntryname[playerid]);
    return 1;
}
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
    strmid(rawdata,data,0,120000,120000);
 /*   preppp = strfind(data,"this.style.backgroundColor");
    if(preppp == -1)
    {
        print(" - iTranslate Functional Error1 - ");
        fremove("src.txt");
        new File:handd = fopen("src.txt");
        fwrite(handd,data);
        fclose(handd);
        return 0;
    }
    strdel(data,0,preppp);
    strdel(data,0,9+76);
    preppp2 = strfind(data,"<");
    if(preppp2 == -1)
    {
        print(" - iTranslate Functional Error2 - ");
        return 0;
    }
    strdel(data,preppp2,strlen(data));
    //strdel(data,strlen(data)-1,strlen(data));
    strpack(gettranslation,data,strlen(data));
    printf("%s to %s",sendtranslation,gettranslation);*/

    SendClientMessage(index,COLOR_GREEN,data);
    new File:handd = fopen("src.txt");
    fwrite(handd,data);
    fclose(handd);
    return 1;
}

public Inter_SendClientMessage(playerid,color,msg[])
{
//  if(translate(playerid,msg,-1)) SendClientMessage(playerid,color,gettranslation);
//  translate(playerid,msg,-1);
    if(strfind(msg," ") != -1)
    {
        for(new lp_form=0;lp_form<=strlen(msg);lp_form++)
        {
            preppp = strfind(msg," ");
            if(preppp == -1) break;
            strdel(msg,preppp,preppp+1);
            strins(msg,"+",preppp,strlen(msg));
        }
    }
//  if(IsPlayerConnected(playerid)) format(url, 255, "%s%s%s%s%s%s%s", "http://translate.******.com/translate_t?hl=&ie=UTF-8&text=",msg,"&sl=",cntryname[playerid],"&tl=",cntryname[playerid],"#");
    format(url, 255, "%s%s%s%s%s%s%s", "http://translate.******.com/translate_t?hl=&ie=UTF-8&text=",msg,"&sl=","en","&tl=",cntryname[playerid],"#");
    HTTP(playerid, HTTP_GET, url, "", "MyHttpResponse");
    SendClientMessage(playerid,color,rawdata);
    return 1;
}
Reply


Messages In This Thread
Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 23.08.2010, 13:07
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 24.08.2010, 04:34
Re: Translation of text using HTTP_GET and ****** translate - by Kyosaur - 24.08.2010, 04:42
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 24.08.2010, 09:00
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 09:53
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 17:57
Re: Translation of text using HTTP_GET and ****** translate - by playbox12 - 25.08.2010, 18:08
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 18:36
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 25.08.2010, 19:50
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 19:54
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 25.08.2010, 20:59
Re: Translation of text using HTTP_GET and ****** translate - by RyDeR` - 25.08.2010, 21:05
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 21:11
Re: Translation of text using HTTP_GET and ****** translate - by RyDeR` - 25.08.2010, 21:17
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 25.08.2010, 21:25
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 26.08.2010, 05:33
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 06:11
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 26.08.2010, 08:24
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 09:06
Re: Translation of text using HTTP_GET and ****** translate - by juice.j - 26.08.2010, 09:16
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 09:19
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 26.08.2010, 10:20
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 10:22
Re: Translation of text using HTTP_GET and ****** translate - by Kalcor - 26.08.2010, 11:33
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 12:58
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 26.08.2010, 17:54
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 18:03
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 26.08.2010, 18:57
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 26.08.2010, 18:58
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 27.08.2010, 09:45
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 27.08.2010, 09:59
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 27.08.2010, 10:21
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 27.08.2010, 20:11
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 28.08.2010, 05:03
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 28.08.2010, 21:35
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 29.08.2010, 17:18
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 29.08.2010, 17:21
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 29.08.2010, 17:57
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 29.08.2010, 18:05
Re: Translation of text using HTTP_GET and ****** translate - by $$$PiMp - 30.08.2010, 09:39
Respuesta: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 15.06.2012, 12:27
Re: Translation of text using HTTP_GET and ****** translate - by Vince - 15.06.2012, 12:42
Respuesta: Re: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 15.06.2012, 13:01
Re: Respuesta: Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 15.06.2012, 13:09
Respuesta: Re: Respuesta: Re: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 15.06.2012, 13:17
Re: Translation of text using HTTP_GET and ****** translate - by robanswe - 15.06.2012, 13:26
Respuesta: Re: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 15.06.2012, 13:27
Respuesta: Re: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 15.06.2012, 14:12
Respuesta: Translation of text using HTTP_GET and ****** translate - by CidadeNovaRP - 19.06.2012, 16:23
Re: Respuesta: Translation of text using HTTP_GET and ****** translate - by robanswe - 19.06.2012, 16:25
Re: Translation of text using HTTP_GET and ****** translate - by Bombo - 03.12.2013, 13:32

Forum Jump:


Users browsing this thread: 2 Guest(s)