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 8435191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:51:00+00:00 2026-06-10T06:51:00+00:00

I have written a small app that uses curl a while ago and was

  • 0

I have written a small app that uses curl a while ago and was working. Today I tried to run it and it is not working.

I use curl to post data to another page located on an external server. The Get is working but not the post.

Update 1:

I have narrowed the error down to having an entry called “SOME_KEY” and having the value “‘@C:/wamp/www/name.pdf'” in the posts array will cause this problom.

Howcome the @ symbole is causing a problem!!! I am trying to uplaod a file to the server

Solved

Check the answer below.

Original entry

My current curl options

    $curl_options = array(
        CURLOPT_RETURNTRANSFER => true,                 // Return web page      
        CURLOPT_HEADER         => false,                // Don't return headers
        CURLOPT_FOLLOWLOCATION => false,                // Follow redirects
        CURLOPT_ENCODING       => "",                   // Handle all encodings
        CURLOPT_AUTOREFERER    => false,                // Set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,                  // Timeout on connect
        CURLOPT_TIMEOUT        => 120,                  // Timeout on response
        CURLOPT_MAXREDIRS      => 0,                    // Stop after 10 redirects
        CURLOPT_USERAGENT      => "regify connector",   // Who am I? FIREFOX, IE, OPERA, CHROME, SPIDER, SEARCH BOT...etc.
    );

the function that posts the data:

function makePostRequest($url, $fields  ){

        //Create the options
        //global $curl_options;
        $curl_options[CURLOPT_URL       ] = $url;
        $curl_options[CURLOPT_POST      ] = count($fields);
        $curl_options[CURLOPT_POSTFIELDS] = $fields;

        $ch = curl_init();
        curl_setopt_array($ch, $curl_options);

        $content = curl_exec ($ch);
        $err     = curl_errno($ch);

        curl_close($ch);    
        return ($err == 0)?$content:false;
    }

PHP’s getallheader is returning

array
  'Host' => string 'localhost' (length=9)
  'Accept' => string '*/*' (length=3)
  'Content-Length' => string '16632433' (length=8)
  'Expect' => string '100-continue' (length=12)
  'Content-Type' => string 'multipart/form-data; boundary=----------------------------93ac4fed717b' (length=70)

CURL’s curl_getinfo function is returning:

    array
  'url' => string 'http://localhost/archieve/index.php' (length=35)
  'content_type' => string 'application/json' (length=16)
  'http_code' => int 200
  'header_size' => int 281
  'request_size' => int 263
  'filetime' => int -1
  'ssl_verify_result' => int 0
  'redirect_count' => int 0
  'total_time' => float 0.125
  'namelookup_time' => float 0
  'connect_time' => float 0
  'pretransfer_time' => float 0
  'size_upload' => float 16632433
  'size_download' => float 18
  'speed_download' => float 144
  'speed_upload' => float 133059464
  'download_content_length' => float 18
  'upload_content_length' => float 16632433
  'starttransfer_time' => float 0.015
  'redirect_time' => float 0
  'certinfo' => 
    array
      empty

Can this porblem be cause by the content type? I read on stackoverflow that it recommaded that CURL is smart enough to set this value by itself.

  • 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-06-10T06:51:01+00:00Added an answer on June 10, 2026 at 6:51 am

    I figured it out. The code was and still working as it should. Curl was not able to post the PDF file, I believe because of permissions, and therefore it was not posting at all.

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

Sidebar

Related Questions

I have written a small chat app that uses mysql + php to facilitate
I have a small app that uses Lua linked as dll (not static). I
I have written a small app that puts my bluetooth in discoverable mode for
i have a very small utilty app written in c# that works fine on
I have written a small app, that has a Activity to control and display
I have a working Facebook app that most users will use just once. Leading
I have written a small util in an app that syncs the time from
I have a small application written in c# as a console app that I
I have written a small android app that grabs some data and displays it
i have written a small codeigniter test app that is currently running on my

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.