Advertisement
Guest User

Untitled

a guest
Dec 14th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2. $sendTo = 'https://ftp.emc.com/....?domain=XX&user=XXX&password=XXX';
  3. $localfile ="23.txt";
  4. $fp = fopen($localfile, 'r');
  5. // Create CURL Connection
  6. $ch = curl_init();
  7. //curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  9. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  10. curl_setopt($ch, CURLOPT_POST, 1);
  11. curl_setopt($ch, CURLOPT_USERPWD, "usr:passwd");
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13. curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  14. curl_setopt($ch, CURLOPT_FAILONERROR, true);
  15. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  16. curl_setopt($ch, CURLOPT_URL, $sendTo);
  17. //curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  18. curl_setopt($ch, CURLOPT_UPLOAD, 1);
  19. curl_setopt($ch, CURLOPT_INFILE, $fp);
  20. curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
  21. echo $ch;
  22. $m=curl_exec ($ch);
  23. echo "m $m<br>";
  24. $error_no = curl_errno($ch);
  25. echo "error_no $error_no<br>";
  26. curl_close ($ch);
  27. if ($error_no == 0) {
  28. $error = 'File uploaded succesfully.';
  29. } else {
  30. $error = 'File upload error.';
  31. }
  32. echo $error;
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement