curl -H 'Authorization: Token token=<your_private_token>' -X POST
-F job[webapp_id]=2
-F job[param]=""
-F files[0]=#test.txt
-F files[1]=#test2.csv
-F job[file_url]="http://www.lirmm.fr/DEMAR/images/inria_corpo_rvb.jpg"
-F job[dataset]=<my_dataset_name> https://allgo.inria.fr/api/v1/jobs
I want to convert this into PHP cURL format. I have tried out something but it isn't working properly. Really would appreciate any help!
Related
I am trying to use a script to interact with the a website however whenever i send my curl post request, nothing is returned.
curl -X POST --proxy 1.1.1.1:9443 \
-H "Content-Type: application/x-www-form-urlencoded" -d d="google.com" -d n="8.8.8.8" \
-d q="A" http://http://www.kloth.net/services/dig.php
I want to call my upload csv api using curl command but no able to upload file on that which gives me error.
Command I am using as follow:
curl -i -X POST -H "Content-Type:application/json" https://api.staging.mailzap.com/api/v1/api-key/upload-csv -d '{"apiKey":"Srkk8RL8xETAeJ0lTm85","email_csv":'#\"C:/Users/viral.champanery/Desktop/publicapi/test.txt\"',"team_id":282}'
following option also not working
curl -i -X POST -H "Content-Type:multipart/form-data;application/json;application/csv;" https://api.staging.mailzap.com/api/v1/api-key/upload-csv -d '{"apiKey":"Srkk8RL8xETAeJ0lTm85","email_csv":"C:/Users/viral.champanery/Desktop/publicapi/test.txt","team_id":282}'
also not working following
curl -i -X POST -H "Content-Type:multipart/form-data;application/json;application/csv;" https://api.staging.mailzap.com/api/v1/api-key/upload-csv -d '{"apiKey":"Srkk8RL8xETAeJ0lTm85","team_id":282}' -F "email_csv=#/C/Users/viral.champanery/Desktop/publicapi/test.csv"
email_csv=#/C/Users/viral.champanery/Desktop/publicapi/test.csv"
help me to upload file with json other parameter in api using curl command
Hi I am using this code to upload a file on Linux from a bash script:
curl -F aok=2 -F Name='azko' -F dir="#path_to_file;filename=zou.odp"
-F "tag=1234" -F "OK=2" -F ecoTime=1 -F
-F ckx=no "http://blabla"
However the error I receive:
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
./up.sh: line 2: -F: command not found
./up.sh: line 3: -F: command not found
I have curl 7.47.0 installed.
So far I tried to put \ at the end of the lines but the error still keeps coming. What am I missing?
When I directly copy this code with \ placed to the terminal it works but this time gives another kind of error
curl: (43) A libcurl function was given a bad argument
I am guessing this is from a directory problem?
You are using -F -F without arguments.
Try:
curl -F aok=2 -F Name='azko' -F "dir=#path_to_file;filename=zou.odp" -F "tag=1234" -F "OK=2" -F ecoTime=1 -F ckx=no "http://blabla"
Also you have either write the whole command in one line (see above) or add \ to the end of the line if the command continues:
curl -F aok=2 -F Name='azko' -F "dir=#path_to_file;filename=zou.odp" \
-F "tag=1234" -F "OK=2" -F ecoTime=1 \
-F ckx=no "http://blabla"
I'm very new to curl and totally confused. My code so far is that:
curl -H 'Content-Type: application/json' -H 'Accept: application/json'\
-F 'name=My new CA' \
-F 'subtype=CUSTOM' \
-F 'description=People who bought from my website' \
-F -d 'rule': {'and': ['or': [{'unit_id': {'gte': '0'}}]]}\
-F 'access_token=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' \
https://graph.facebook.com/v2.5/act_XXXXXXXXXXXXXX/customaudiences
I can't figure out how to post that nested request and I get the following error:
Warning: Illegally formatted input field!
curl: option -F: is badly used here
curl: try 'curl --help' or 'curl --manual' for more information
Any suggestions are appreciated! Thanks
Look at what you're sending:
-F -d 'rule': {'and': ['or': [{'unit_id': {'gte': '0'}}]]}\
^--start string
^--end string
^--random garbage
^--start another string
^--end string
I have the following command line script right now:
df -h | curl -F stuff=test http://foo.com
Which will send an POST Request to foo.com. In the $_POST variable I have the following data set:
[stuff] => test
Now I want to change test with the output from df -h so I can see it in my $_POST variable.
How can I do this?
You can use xargs
df -h | xargs -I % curl -F stuff=% http://foo.com
What have you tried? This might accomplish the goal. Try it out and let me know.
curl -F "stuff=`df -h`" http://foo.com