Skip to content

Instantly share code, notes, and snippets.

@gicappa
Created July 19, 2025 22:25
Show Gist options
  • Save gicappa/9d1199be32b8edf632b5039df4b3ccf6 to your computer and use it in GitHub Desktop.
Save gicappa/9d1199be32b8edf632b5039df4b3ccf6 to your computer and use it in GitHub Desktop.
passing env variable in curl --data-binary
export CODE_VALUE="life"
curl 'https://codes.thisisnotawebsitedotcom.com/' \
--compressed \
-X POST \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Referer: https://thisisnotawebsitedotcom.com/' \
-H 'Content-Type: multipart/form-data; boundary=----ste' \
-H 'Origin: https://thisisnotawebsitedotcom.com' \
-H 'Connection: keep-alive' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Priority: u=0' \
--data-binary $'------ste\r\nContent-Disposition: form-data; name="code"\r\n\r\n'"${CODE_VALUE}"$'\r\n------ste--\r\n'
@gicappa
Copy link
Author

gicappa commented Jul 20, 2025

export CODE_VALUE="life"

curl 'https://codes.thisisnotawebsitedotcom.com/' \
  --compressed \
  -X POST \
  -H 'Accept: */*' \
  -H 'Content-Type: multipart/form-data; boundary=----ste' \
  --data-binary $'------ste\r\nContent-Disposition: form-data; name="code"\r\n\r\n'"${CODE_VALUE}"$'\r\n------ste--\r\n'

@gicappa
Copy link
Author

gicappa commented Jul 20, 2025

import requests

CODE_VALUE = "life"
url = "https://codes.thisisnotawebsitedotcom.com/"

# Prepare the multipart/form-data body manually to match the custom boundary and structure
boundary = "----ste"
body = (
    f"--{boundary}\r\n"
    'Content-Disposition: form-data; name="code"\r\n'
    '\r\n'
    f'{CODE_VALUE}\r\n'
    f'--{boundary}--\r\n'
)

headers = {
    "Accept": "*/*",
    "Content-Type": f"multipart/form-data; boundary={boundary}",
}

response = requests.post(
    url,
    data=body.encode("utf-8"),
    headers=headers
)

print("Status code:", response.status_code)
print("Response text:", response.text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment