Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. cURL is not able to upload file on scribd
  2. <?php
  3.     $ch = curl_init();
  4.     curl_setopt($ch, CURLOPT_HEADER, 0);
  5.     curl_setopt($ch, CURLOPT_VERBOSE, 0);
  6.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
  8.     curl_setopt($ch, CURLOPT_URL, _'http://www.scribd.com/upload/supload');
  9.     curl_setopt($ch, CURLOPT_POST, true);
  10.     // same as <input type="file" name="file_box">
  11.     $post = array(
  12.     $path=getcwd(); //absolute path
  13.     $post = array(
  14.         "file"=>"@".$path."/test.txt",
  15.     );
  16.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  17.     $response = curl_exec($ch);
  18. ?>
  19.        
  20. $response = curl_exec($ch);
  21. if ($response === false) {
  22.    die(curl_error($ch));
  23. }