php curl 上传到megaupload

发布于 2024-11-08 10:55:59 字数 1708 浏览 0 评论 0原文

我创建了一个 php 脚本来将文件上传到我的帐户上的 megaupload,但我在上传部分遇到一些问题。 我正在将 Curl 与 php 一起使用。

我设置了以下选项:

CURLOPT_POST => 1
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
CURLOPT_FRESH_CONNECT => 1
CURLOPT_RETURNTRANSFER => 1
CURLOPT_FORBID_REUSE => 1
CURLOPT_TIMEOUT => 10

CURLOPT_COOKIE => session_name() . '=' . session_id()
CURLOPT_COOKIE => realpath($cookie)
CURLOPT_COOKIEJAR => realpath($cookie)
CURLOPT_COOKIEFILE => realpath($cookie)

我发送第一篇帖子以连接到我的帐户。 这部分似乎有效,当我检查帐户页面时,我得到了我的信息。

然后我尝试使用多重上传表单发送文件

    $multi = $this->getPage("/multiupload/index.php");
    preg_match('#http://[w]{3}[0-9]#', $multi, $match);

    $startPos = strpos($multi, $match[0]);
    $endPos = strpos($multi, "\"", $startPos);
    $link = substr($multi, $startPos, $endPos - $startPos);
    echo "Link = " . $link . "\n";

    $startPos = strpos($link, "UPLOAD_IDENTIFIER=") + 18;
    $endPos = strlen($link);
    $id = substr($link, $startPos, $endPos - $startPos);
    echo "id = " . $id . "\n";

    $this->setPost(array ("sessionid" => "" . $id . "",
                            "UPLOAD_IDENTIFIER" => "" . $id . "",
                            "file" => "@" . realpath($fileName),
                            "message" => "abc",
                            "toemail" => "",
                            "fromemail" => "",
                            "password" => "",
                            "trafficurl" => "",
                            "multiemail" => ""));
    $page =  $this->getPage($link, 1);

,但收到“空回复”答案,

我不明白为什么我的请求是错误的。

谢谢您的回答。

I create a php script to upload a file to megaupload on my account but I have some problem on the upload part.
I'm using Curl with php.

I set the following options:

CURLOPT_POST => 1
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
CURLOPT_FRESH_CONNECT => 1
CURLOPT_RETURNTRANSFER => 1
CURLOPT_FORBID_REUSE => 1
CURLOPT_TIMEOUT => 10

CURLOPT_COOKIE => session_name() . '=' . session_id()
CURLOPT_COOKIE => realpath($cookie)
CURLOPT_COOKIEJAR => realpath($cookie)
CURLOPT_COOKIEFILE => realpath($cookie)

I send a first post to connect to my acount.
This part seem to work, when I check the acount page I get my info.

Then I try to send a file with the multiupload form

    $multi = $this->getPage("/multiupload/index.php");
    preg_match('#http://[w]{3}[0-9]#', $multi, $match);

    $startPos = strpos($multi, $match[0]);
    $endPos = strpos($multi, "\"", $startPos);
    $link = substr($multi, $startPos, $endPos - $startPos);
    echo "Link = " . $link . "\n";

    $startPos = strpos($link, "UPLOAD_IDENTIFIER=") + 18;
    $endPos = strlen($link);
    $id = substr($link, $startPos, $endPos - $startPos);
    echo "id = " . $id . "\n";

    $this->setPost(array ("sessionid" => "" . $id . "",
                            "UPLOAD_IDENTIFIER" => "" . $id . "",
                            "file" => "@" . realpath($fileName),
                            "message" => "abc",
                            "toemail" => "",
                            "fromemail" => "",
                            "password" => "",
                            "trafficurl" => "",
                            "multiemail" => ""));
    $page =  $this->getPage($link, 1);

But I receive a "Empty reply" answer

I can't figure out why my request is wrong.

Thank you for your answers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-11-15 10:55:59

在此上传,

http://www1016.megaupload.com/upload_done.php?UPLOAD_IDENTIFIER=01310301330397063843100367215169&user=[USER]&s=[SIZE]

确保您通过了所有必要的邮政字段

upload here

http://www1016.megaupload.com/upload_done.php?UPLOAD_IDENTIFIER=01310301330397063843100367215169&user=[USER]&s=[SIZE]

make sure you are passing all the necessary postfields

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文