Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3.         $ch = curl_init();
  4.  
  5.         curl_setopt($ch, CURLOPT_URL, "https://php.net/manual/pt_BR/curlfile.setmimetype.php");
  6.         curl_setopt($ch, CURLOPT_HEADER, 0);
  7.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  8.         /*$cfile = new CURLFile("cats.jpg", "image/jpg", "test_name");
  9.         $data = array('test_file' => $cfile);
  10.         curl_setopt($ch, CURLOPT_POST, 0);
  11.         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);*/
  12.  
  13.         curl_exec($ch);
  14.  
  15.         if($errno = curl_errno($ch)){
  16.                 $error_message = curl_strerror($errno);
  17.                 echo("cURL error({$errno}):\n {$error_message}");
  18.         }
  19.  
  20.         echo("<br />");
  21.  
  22.         echo(curl_unescape($ch, curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)));
  23.  
  24.         echo("<br />");
  25.  
  26.         //echo(CURLFile::getFilename());
  27.  
  28.         echo("<br />");
  29.  
  30.         //echo(CURLFile::getMimeType());
  31.  
  32.         echo("<br />");
  33.  
  34.         //echo(CURLFile::getPostFilename());
  35.  
  36.         echo("<br />");
  37.  
  38.         curl_close($ch);
  39.  
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement