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

  • Home
  • SEARCH
  • 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 6620077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:03:12+00:00 2026-05-25T21:03:12+00:00

I’ve searched for this answer but not found anything that works or that completely

  • 0

I’ve searched for this answer but not found anything that works or that completely matches my problem.

Using Unix cURL, I need to POST a key/val pair to a server. The key will be “MACs”, and the contents of a file of newline separated MAC addresses will be the VALUE for this POST.

I’ve tried:

curl -d @filename http://targetaddress.com, but when the target receives the incoming POST, the POST var is empty. (PHP is receiving).

I’ve seen other forms of curl mentioned on this site, using --url-encode which says it is not a valid option for curl on my system…

How do you POST the contents of a file as a value to a specific key in a POST using UNIX cURL?

  • 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-25T21:03:12+00:00Added an answer on May 25, 2026 at 9:03 pm

    According to curl man page -d is the same as –data-ascii. To post the data as binary use –data-binary and to post with url encoding use –data-urlencode. So as your file is not URL encoded if you want to send it URL encoded use:

    curl --data-urlencode @file http://example.com
    

    If you file contains something like:

    00:0f:1f:64:7d:ff
    00:0f:1f:64:7d:ff
    00:0f:1f:64:7d:ff
    

    this will result in a POST request received something like:

    POST / HTTP/1.1
    User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15
    Host: example.com
    Accept: */*
    Content-Length: 90
    Content-Type: application/x-www-form-urlencoded
    
    00%3A0f%3A1f%3A64%3A7d%3Aff%0A00%3A0f%3A1f%3A64%3A7d%3Aff%0A00%3A0f%3A1f%3A64%3A7d%3Aff%0A
    

    If you want to add a name you can use multipart form encoding something like:

    curl -F MACS=@file http://example.com
    

    or

    curl -F MACS=<file http://example.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.