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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:49:50+00:00 2026-05-13T10:49:50+00:00

This works: curl –url http://someurl.tld –form apikey=39485730 This does not: curl –url http://someurl.tld –form

  • 0

This works:

 curl  --url http://someurl.tld  --form "apikey=39485730"

This does not:

 curl  --url http://someurl.tld  --form "apikey=<keyfile"

Error:
Invalid API keys

The cURL manual (http://curl.haxx.se/docs/manpage.html) explicitly states

-F/–form (HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. […] To force the ‘content’ part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.

FWIW:
If I use –form “apikey=@keyfile” I get the error: “API key is required”.
This confirms that @ is definately wrong (which I am okay with).
But why does < not work, and what to do about it?

It looks as if the content of the file is either not passed on, or wrong. Thus I’ve made quadruple sure, that only the api key (here: 39485730) and nothing else is in the file.

If it’s important why I am trying to do this:
I need this curl-command in scripts, and don’t want to put the API key there. Instead, it should be in the HOME of the user who runs this script, only readable by him, and nobody else.

Thank you in advance for any insight… 🙂

  • 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-13T10:49:50+00:00Added an answer on May 13, 2026 at 10:49 am

    I think you might have a trailing newline in keyfile. You can check this with:

    xxd keyfile
    

    There should be no 0a at the end. If there is, you can re-create the keyfile without the trailing newline like this:

    echo -n 39485730 > keyfile
    

    and try again with the new keyfile.

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

Sidebar

Related Questions

Why this curl command does not work in CMD. It should downlaod a html
This works: require 'csv' file = CSV.open(filename) puts file.shift This does not: require 'csv'
This works great to get the header $imageurl = http://p.twimg.com/AW2-vIUCAAE_1FN.png; $ch = curl_init(); curl_setopt
this is the curl code that works in command line : $ curl -F
Can anyone convert this curl command that works in command line to php code
curl https://api.box.com/2.0/folders/0 -H Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN This works and returns exactly what I would
This command works fine: $ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) However, I
This is the script that works: curl -H 'content-type:application/json' -d '{userrequest: {username: testname, status:
The following example is taken from: http://php.net/manual/en/function.curl-multi-close.php#example-3540 This example will create two cURL handles,
I am trying to do some curl'ing from PHP I have: $url=http://sites.target.com/site/en/spot/mobile_fiats_results.jsp?_DARGS=/site/en/spot/mobile_fiats.jsp&asin=&dpci=.$arriPadSKU[$counter].&zipcode=.$vZip.&city=&state=; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,

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.