Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
curl request to guzzle

how convert this curl request

curl request

curl -L -F 'Request={"APIRequests":
[{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]}' -F
'PropertyRelease=@Documents/jamie.pdf' https://api2.dreamstime.com/api/

to guzzlehttp request

guzzlecode


$client = new \GuzzleHttp\Client();

$response = $client->request('POST', "https://api2.dreamstime.com/api/",[
  'json'=>[
    'APIRequests' => [
            [
              "Verb" => "UploadRelease",
              "AuthToken" => $this->getAccessToken(),//token
              "ModelRelease" => $file,//file path
              "FirstName" => $firstName,
              "LastName" => $lastName,
              "Gender" => $gender,
              "Country" => $country,
              "AgeGroup" => $ageGroup,
              "Ethnics" => $ethnics,
            ],
        ],
  ]
]);

error "please upload a release file"

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I have written a query closest to the curl request, as curl request has a -F with file that means that it is sending file, you will need multipart. As I have not tested so I can't guarantee that it will work though

/**
 curl -L -F 'Request={"APIRequests":
[{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]}' -F
'PropertyRelease=@Documents/jamie.pdf' https://api2.dreamstime.com/api/

*/
$client = new \GuzzleHttp\Client();

$response = $client->request('POST', "https://api2.dreamstime.com/api/",[
    'multipart' => [
        [
            'name'     => 'Request',
            'contents' => '{
                            "APIRequests":
                                [{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
                                ":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]
                            }' // place your json_encode here inplace of above
        ],
        [
            'name'     => 'PropertyRelease',
            'contents' => fopen("/path/to/file", "r")
        ]
    ]
]);
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda