ich habe folgendes Problem, ich möchte gerne eine Datei von meinem Server auf einen anderen Server (Video Hoster) hochladen nur will dies nicht funktionieren. Es werden auch keine Errors angezeigt.
Hier ist einmal das Script:
PHP Code:
<?php
class curl
{
function __construct($use = 1)
{
$this->ch = curl_init();
if($use = 1)
{
curl_setopt ($this->ch, CURLOPT_POST, 1); // ENABLE HTTP POST
curl_setopt ($this->ch, CURLOPT_COOKIEJAR, 'cookie.txt'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($this->ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
}
else
{
return 'There is the possibility, that this script wont work';
}
}
function first_connect($loginform,$logindata)
{
curl_setopt($this->ch, CURLOPT_URL, $loginform); // SET URL FOR THE POST FORM LOGIN
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $logindata); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
}
function store() //to safe the login
{
$store = curl_exec ($this->ch);
}
function execute($page) //to move through the intern area
{
curl_setopt($this->ch, CURLOPT_URL, $page);
$this->content = curl_exec ($this->ch);
}
function close()
{
curl_close ($this->ch);
}
function __toString()
{
return $this->content;
}
}
$postdata = array("name" => "file[]",
"filename" => "@".realpath("Hagure.mp4"));
$getit = new curl();
$getit->first_connect('http://yourupload.com/index.php?act=login&login=true','login=true&file_session=&email=
&password=dein-passwort&upload=Login'); //Variiert von Seite zu seite.
$getit->store();
$getit->execute('http://yourupload.com/index.php?act=user&do=home');
$getit->first_connect('http://yourupload.com/index.php?act=files&do=upload',$postdata); //Variiert von Seite zu seite.
$getit->store();
$getit->close();
?>
Hier das Packet:
Code:
http://yourupload.com/index.php?act=files&do=upload POST /index.php?act=files&do=upload HTTP/1.1 Host: yourupload.com User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20100101 Firefox/15.0.1 Accept: text/javascript, text/html, application/xml, text/xml, */* Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Connection: keep-alive X-Requested-With: XMLHttpRequest Referer: http://yourupload.com/index.php?act=user&do=home Content-Length: 41648931 Content-Type: multipart/form-data; boundary=---------------------------265001916915724 Cookie: _pk_ref.9.d1ba=%5B%22%22%2C%22%22%2C1347200605%2C%22http%3A%2F%2F62.75.242.162%2Findex.php%22%5D; _pk_id.9.d1ba=08e499ca1b88c81c.1345157523.12.1347203814.1347189831.; PHPSESSID=jjajqi2mi7fe1blso5qvge9ue5; _pk_ses.9.d1ba=*; member_id=3051; member_pass=xxx Pragma: no-cache Cache-Control: no-cache -----------------------------265001916915724 Content-Disposition: form-data; name="file[]"; filename="Hagure.mp4" Content-Type: video/mp4 HTTP/1.1 200 OK Server: nginx/0.7.67 Date: Sun, 09 Sep 2012 15:23:56 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.3.3-7+squeeze13 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache






