LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2013, 10:57 AM   #1
anuRV
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Rep: Reputation: Disabled
Help needed with curl library


Hi,

I am trying to post the current-time using curl library.

curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "ts",
CURLFORM_COPYCONTENTS, getCurrentTime(), //error!!
CURLFORM_END);

//getCurrentTime() is a method that returns string.

Can anyone help me with how I can do this. I am pretty new to curl.
Any help in this would be highly appreciated.

Thanks in advance!!
ANRV
 
Old 12-06-2013, 11:13 AM   #2
Spect73
Member
 
Registered: Aug 2013
Distribution: Slackware 14.1
Posts: 128

Rep: Reputation: Disabled
Quote:
Originally Posted by anuRV View Post
Hi,

I am trying to post the current-time using curl library.

curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "ts",
CURLFORM_COPYCONTENTS, getCurrentTime(), //error!!
CURLFORM_END);

//getCurrentTime() is a method that returns string.

Can anyone help me with how I can do this. I am pretty new to curl.
Any help in this would be highly appreciated.

Thanks in advance!!
ANRV
From man curl_formadd:
Code:
       CURLFORM_COPYCONTENTS
              followed by a pointer to the contents of this part,  the  actual
              data  to  send  away.  libcurl copies the provided data, so your
              application doesn't need to keep it around after  this  function
              call.  If the data isn't null terminated, or if you'd like it to
              contain zero bytes, you must set the length  of  the  name  with
              CURLFORM_CONTENTSLENGTH.  The  copied  data  will  be  freed  by
              curl_formfree(3).
It would appear that getCurrentTime() needs to be called before the call to curl_formadd(). I'm assuming that getCurrentTime() returns a character pointer, so try creating a character pointer to hold the return from getCurrentTime() and put the variable in the curl_formadd() call.
 
1 members found this post helpful.
  


Reply

Tags
curl, curllibrary



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget/curl, expert knwledge needed blnl Programming 3 08-30-2012 05:48 AM
[SOLVED] cURL library support conflicker Linux - Newbie 3 06-12-2012 01:35 PM
Retrieving HTML string with cURL library in C GamezR2EZ Programming 4 04-15-2012 07:33 PM
PHP cURL Help needed gregaizi Programming 1 12-30-2011 04:13 AM
Library Application Needed kmadhukar Linux - Software 1 05-05-2003 03:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration