Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!