Anyone have any time to take a look at the below? There's an entire community 
behind the game ut2004 that is crying out for this. If you can help with this 
function, I can complete the rest. :-)

Sent from my iPhone

On 14 Jun 2013, at 22:57, "Spencer Elliott" <[email protected]> wrote:

> Dan,
> 
> I really appreciate the link. I did locate it and read it before posting (I
> should of mentioned it).
> I am unsure how to incorporate this though when I need to initially post the
> authentication, too. 
> I have tried modifying the below function, and it seems to have some success
> (does not respond with a 401 message), but I do not believe the message is
> being sent, or that the message is the right message.
> 
> Would anyone be able to:
> 
> *    Suggest what the actual param should be used in the function below,
> based on the header file information:
> "SendText=say+This+is+a+test&Send=Send"
> *    Improve the function below, as I am not sure it's actually correct.
> 
> 
> void SendChat(const char * str)
> {
>    CURL *curl;
>    CURLcode res;
> 
>    curl = curl_easy_init();
>    if(curl) 
>    {
>        std::string response;
>        char data[128];
> 
>        curl_easy_setopt(curl, CURLOPT_USERAGENT, "User-Agent:
> Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0");
>        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
>        curl_easy_setopt(curl, CURLOPT_POST, 1);
>        sprintf(data, "%s:%s", WebAdminUserName, WebAdminPassword);
>        curl_easy_setopt(curl, CURLOPT_USERPWD, data);
>        sprintf(data, "UserName=%s&Password=%s", WebAdminUserName,
> WebAdminPassword);
>        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
>        curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookie");
>        curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookie"); 
> 
>        sprintf(data, "%s/ServerAdmin/current_console_send",
> WebAdminURL);
>        curl_easy_setopt(curl, CURLOPT_URL, data);
>        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, str);
>        curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE,
> (long)strlen(str));
> 
>        res = curl_easy_perform(curl);
> 
>        if(CURLE_OK == res) 
>        {
>            char *ct;
>            res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE,
> &ct);
> 
>            if((CURLE_OK == res) && ct)
>            {
>                printf("We received Content-Type: %s\n",
> ct);
>            }
>            curl_easy_cleanup(curl);
>        }
> 
>        printf("\n");
>        printf(response.c_str());
>        printf("\n");
>    }
> }
> 
> 
> 
> -----Original Message-----
> From: curl-library [mailto:[email protected]] On Behalf Of
> Dan Fandrich
> Sent: 14 June 2013 21:55
> To: [email protected]
> Subject: Re: Content-Type: application/x-www-form-urlencoded;
> SendText=say+This+is+a+test&Send=Send
> 
> On Fri, Jun 14, 2013 at 07:42:02PM +0100, Spencer Elliott wrote:
>> Would anyone be kind enough to post an updated function of the above, 
>> that would allow me to pass the function param "str" to the server 
>> page, where the data I would like to send is
> "SendText=say+This+is+a+test&Send=Send"?
>> 
>> I know it's cheeky to ask, but with a nice example I believe I'll be 
>> able to make many more functions that I require.
> 
> Indeed, so it's lucky someone has already written such an example:
> http://curl.haxx.se/libcurl/c/simplepost.html
> 
>>>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html
> 
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to