Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. // Add it to S3
  2. $file = $_FILES["fileToUpload"]['tmp_name'];
  3.  
  4. // Uploaded:
  5. $s3->putObject(
  6.     [
  7.         'Bucket' => $bucketName,
  8.         'Key' => $keyName,
  9.         'SourceFile' => $file,
  10.         'StorageClass' => 'REDUCED_REDUNDANCY'
  11.     ]
  12. );
  13.  
  14. // create curl object
  15. $url = 'https://api.publicapis.org/entries';
  16. $data = array("Auth" => $file);
  17.  
  18. $postdata = json_encode($data);
  19.  
  20. $ch = curl_init($url);
  21. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  22. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  23. curl_setopt($ch, CURLOPT_POST, 1);
  24. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  25. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  26. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  27. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
  28. $result = curl_exec($ch);
  29. curl_close($ch);
  30. print_r ($result);
  31.  
  32.  
  33. echo 'Done';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement