Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add it to S3
- $file = $_FILES["fileToUpload"]['tmp_name'];
- // Uploaded:
- $s3->putObject(
- [
- 'Bucket' => $bucketName,
- 'Key' => $keyName,
- 'SourceFile' => $file,
- 'StorageClass' => 'REDUCED_REDUNDANCY'
- ]
- );
- // create curl object
- $url = 'https://api.publicapis.org/entries';
- $data = array("Auth" => $file);
- $postdata = json_encode($data);
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
- $result = curl_exec($ch);
- curl_close($ch);
- print_r ($result);
- echo 'Done';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement