Advertisement
mestretcp

how to post data using curl

Jan 17th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.17 KB | None | 0 0
  1. #Exemplo de CURL preenchendo campos de formulário com -F
  2.  
  3. curl -X POST -F 'tipo_cnpj=dest' -F 'txtCnpj=99999999999’ -F 'tipo_pesquisa=nf' -F 'txtNumDoc=99999’ http://transportadora.local/jamef/ocorrenciaViagem.do
  4.  
  5.  
  6. #Exemplo de CURL enviando conteúdo em json e modificando headers
  7.  
  8. curl --request POST "http://interno.local/json_decode.php" --header "Content-Type: application/json" --header "MerchantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --header "MerchantKey: 0123456789012345678901234567890123456789" --header "RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --data '{"MerchantOrderId":"2014111703","Customer":{"Name":"Comprador crédito simples"},"Payment":{"Type":"CreditCard","Amount":15700,"Installments":1,"SoftDescriptor":"123456789ABCD","CreditCard":{"CardNumber":"4500000000000001”,”Holder":"Teste Holder","ExpirationDate":"12/2030","SecurityCode":"123","Brand":"Visa"}}}' --verbose
  9.  
  10. curl --request POST "http://sandbox.local/try_json/" --header "Content-Type: application/json" --header "DEVICE_ID: 0123456789012345678901234567890123456789" --header "USRAPP_ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --data '{"usuarioapp":{"cpf":"00000000000","nome":"Nome do fulano","apelido":"Fulano","email":"email@dominio.com","senha":"123456","token_fb":"fh30f28744hg240784gh24","nascimento":"1982-07-08","sexo":"M","ddd":84,"telefone”:999999999,”recebe_sms":1}}' --verbose
  11.  
  12. #Exemplo de curl com parâmetros com -d
  13.  
  14. curl -d "crm=4306&uf=RN" "http://cfm.local/index.php?option=com_medicos&dadosDoMedico=true"  --verbose
  15.  
  16.  
  17. #Exemplo de curl com múltiplas linhas para melhor visualização
  18.  
  19. curl --request POST "https://sandbox.local/try_json/" \
  20. --header "Content-Type: application/json" \
  21. --header "APPOS: Android" \
  22. --header "APPVER: 0.0.1" \
  23. --header "APPID: 98765432109876543210" \
  24. --header "DEVICEID: 0123456789012345678901234567890123456789" \
  25. --header "USRAPPID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  26. --data '{"usuarioapp":{"cpf":"00000000000","nome":"Nome do fulano","apelido":"Fulano","email":"email@dominio.com","senha":"123456","token_fb":"fh30f28744hg240784gh24","nascimento":"1982-07-08","sexo":"M","ddd":84,"telefone”:999999999,”recebe_sms":1}}' --verbose
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement