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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:16:42+00:00 2026-06-17T13:16:42+00:00

I am trying to set up the php curl library call to take: curl

  • 0

I am trying to set up the php curl library call to take:

curl --location \
     --header "authorization: LOW $accesskey:$secret" \
     --upload-file /home/samuel/public_html/intro-to-k.pdf \
     http://s3.us.archive.org/sam-s3-test-08/demo-intro-to-k.pdf

(this is for Internet archive’s api: http://archive.org/help/abouts3.txt )

This is currently on a Windows 7 dev box, but will be moving to Ubuntu

I have tried:

        $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('authorization: LOW XXXX:XXXXX'));
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_URL, 'http://s3.us.archive.org/a_tested_working_dir/the_file_ane_and_ext' );
    $post_array = array(
        "upload-file"=>file_get_contents($absolute_path_to_my_file)
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
    $response = curl_exec($ch);
    echo $response;

Error: MalformedPOSTRequestThe body of your POST request is not well-formed multipart/form-data.bucket must be in dns hostnameXXXXXXXXXX

I’m able to substitute my own values into the cli curl statement & upload without issue; I just can’t seem to get the php curl correct

TIA!


A –libcurl dump produced:

CURLcode ret;
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)64d);
curl_easy_setopt(hnd, CURLOPT_URL, "http://s3.us.archive.org/jeffs_test_1301_librivox/test-francesbaird3.mp3");
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1);
curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3");
curl_easy_setopt(hnd, CURLOPT_CAINFO, "C:\Program Files\Git\bin\curl-ca-bundle.crt");
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYPEER, 1);
curl_easy_setopt(hnd, CURLOPT_SSH_KNOWNHOSTS, "c:/Users/JMadsen/_ssh/known_hosts");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50);
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);

I think it might be ssl verify, but just tried setting to false & no change

  • 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-17T13:16:44+00:00Added an answer on June 17, 2026 at 1:16 pm

    The post field initialization for uploading file is wrong. You dont need to pass contents of file. Just pass the path of the file with @ prefix.

    $post_array = array(
        "upload-file"=>'@'. $absolute_path_to_my_file
    );
    

    According to the --libcurl dump add the following options too.

    curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
    curl_setopt($ch, CURLOPT_UPLOAD, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3");
    curl_setopt($ch, CURLOPT_CAINFO, "C:\Program Files\Git\bin\curl-ca-bundle.crt");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_SSH_KNOWNHOSTS, "c:/Users/JMadsen/_ssh/known_hosts");
    curl_setopt($ch, CURLOPT_MAXREDIRS, 50);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up a batch file to automatically deploy a php app
I'm trying to upload a picture to a specific website using php cURL but
I am trying to set cookie through cURL in PHP but it fails. my
I'm trying to upload files to RapidShare using their API and PHP with cURL.
I have been trying to set up curl with php 5 and apache 2.2
I am trying to set up a PHP path to my Zend Framework. I
I'm trying to set up some exotic PHP code (I'm not an expert), and
Trying to learn about php's arrays today. I have a set of arrays like
I'm simply trying to automatically login to a login form via php and cURL
I'm trying to use cURL and PHP to download the HTML source (as it

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.