Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
Pages: 1
Hi,every one
    "INET",
    "INETGetURL",
    "INETGetURLex",
    "INETGetURLex2", //$ LB (27/08/2001) : allow to add field(s) in the header of the request
    "INETStopURL",
    "INETdisableProxy"
where can i find these function's api doc?
thanks,
Kenshin
Offline
Hi,
You can found this here : http://www.scolring.org/files/doc_html/ … _side.html
Note : INETGetURLex should not use to write a new code. Use INETGetURLex2 instead.
What do you make it ? (if any)
iri
Offline
thank you.
I have got it.
/* int INETGetURLex2 (mmachine m)                       */
/*                                                      */
/* same as INETGetURLex, but the supplementary fourth   */
/* parameter (S) allow to adds field(s) in the request  */
/* header.                                              */INETGetURL
_callback_    
    callback function, called when data is retrieved from server. but I think the callback function's explanation lack of parameter's explanation.
Kenshin
Offline
Ok
Tpypically, INETGetURL is used to send the GET http request.
INETGetURLex2 is used to send a POST http request.
1- type of INETGetURLex2 :
fun [Chn S S S S I fun [INET u0 S I] u1 u0] INETChn : the channel (generally, the currrent channel (_channel function))
S : the type of the request. Normally "POST"
S : the url (http://www.example.com/script.test)
S : the header of the request. By example : content-type: application/x-www-form-urlencoded
S : the datas to send
I : the mode. Should be 0 (zero)
fun [INET u0 S I] u1 : the type of the callback function
u0 : a parameter of your convenience
Return (INET) : the new request
2- This function (as INETGetURL) is asynchronous. When a data is received from the server, the callback is called.
3- Basic example :
typeof inet = INET;;                                      /* this variable will content the created request */
typeof datatmp = S;;                                      /* it saves the temporarly datas from the server */
fun my_inet_callback (request, user_parameter, data_received, error)=
    if (error == 0) then                                  /* error = 0 -> all datas are not received yet */
    (
        set datatmp = strcat datatmp data_received;       /* concatenates the data to those already received */
        0
     )
     else if (error == 1) then                            /* error == 1 -> the transfer is complete */
     (
         _fooS "the transfer is complete";
        0
     )
     else                                                 /* error code returned by the server */
     (
         _fooS strcat "An error occurs. Returned code is : " itoa error;
         0
     );
    0;;
fun main ()=
    _showconsole;                                          /* display the console */
    INETGetURLex2
        _channel                                          /* current channel where the request have to created */
        "POST"                                            /* the method ... */
        "http://www.example.com/script.test"              /* url */
        "content-type: application/x-www-form-urlencoded" /* header */
        "arg=test"                                        /* datas to send */
        0
        @my_inet_callback                                 /* the callback function */
        "my name";                                        /* any user parameter */
    0;;Other example on http://code.irizone.net/index.php?menu= … _http_POST but it is in French.
iri
Offline
Awesome!
thanks a lot
Offline
Pages: 1