Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7580675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:58:34+00:00 2026-05-30T17:58:34+00:00

I’m making simple http post request using libcurl to index.php file on my web

  • 0

I’m making simple http post request using libcurl to index.php file on my web server
that has the following simple code writing post data to a file

if (isset($_POST['abc'])){
    $log="abc.log";
    $h=fopen($log,"w");
    fwrite($h,$_POST['abc']);
    fclose($h);
}  

while my written c++ code implementing http post request is the following

    CURL *curl;
    CURLcode res;
    curl=curl_easy_init();
    string url=AnsiString("http://127.0.0.1/curl/index.php?abc=123").c_str();
    string data="abc=3434";
    if (curl) {

        curl_easy_setopt(curl, CURLOPT_POST, 1);
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS,AnsiString("abc=3434").c_str());
        curl_easy_setopt(curl, CURLOPT_URL,AnsiString("http://127.0.0.1/curl/index.php").c_str());
        res=curl_easy_perform(curl);
        curl_easy_cleanup(curl);
    }

First, posting is enabled curl_easy_setopt(curl, CURLOPT_POST, 1);

Second, if I debug this code i get CURL_OK status in res (return value)
and also TCP 127.0.1:80 will be established everytime i run the code monitoring via netstat -ano 15 but the file abc.log is empty

What’s wrong with this??
Haven’t you any idea pointing me to the right way?

Thank you
in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:58:36+00:00Added an answer on May 30, 2026 at 5:58 pm

    Sending CURLOPT_POSTFIELDSIZE helped!
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE,data.Length());

    Apache log says it’s ok you’ve sent POST

    127.0.0.1 - - [03/Mar/2012:17:39:06 +0500] "POST /curl/post.php HTTP/1.1" 200 -

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.