Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------1088570827734100011725332862
- Content-Disposition: form-data; name="file"; filename="testing-upload.pdf"
- Content-Type: application/x-pdf
- %PDF-1.7
- %âãÏÓ
- 1 0 obj
- <</Type /Catalog
- /Outlines 27 0 R
- /Pages 4 0 R
- >>
- endobj
- xì} `Eö÷«êéIfLBHBÉÉÎpÜGÉ®$IDeð@DeYeYd]Ù¨¨è
- ^((xàâù~U3 QQ?÷oÿ÷êuÕ«ªW¯^WwÍLbDf ´
- Kß9ññuÇló¥
- M¿éå{ilØ
- //PLEASE NOTE I CUT OFF MUCH OF THIS PDF FILE DATA ABOVE
- -----------------------------1088570827734100011725332862
- Content-Disposition: form-data; name="ProjectFile"
- {
- "EffectiveOn": "2016-10-26T16:53:56.861Z",
- "ProjectId": 1582108
- }
- -----------------------------1088570827734100011725332862--
- <?php
- $filetoupload = 'C:testing-upload.pdf';
- $data = array (
- "file" => array("filedata" => '@' . $filetoupload, "filename" => "testing-upload.pdf"),
- "ProjectFile" => array(
- "EffectiveOn" => "2016-10-14T16:22:38.191Z",
- "ProjectId" => "1582108",
- ));
- // json encode data
- $data_string = json_encode($data);
- // set up the curl resource
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://api.example.com");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'password: 12345',
- 'username: demouser' ,
- 'Content-Type: multipart/form-data'
- ));
- // execute the request
- $output = curl_exec($ch);
- // output data
- echo($output) . PHP_EOL;
- // close curl resource to free up system resources
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement