Hi everyone
I am trying to post "POST" data to a remote server using my own remote server. I can achieve posting the data from my local computer using the following code (of course putting a file in the file field):
<form method="post" enctype="multipart/form-data"
action="http://www27.megaupload.com/upload_done.php?UPLOAD_IDENTIFIER=41594851.1121416422">
<input type="hidden" name="UPLOAD_IDENTIFIER" value="41594851.1121416422">
<input type="hidden" name="sessionid" value="41594851.1121416422">
<input type="file" name="file">
<input type="hidden" name="message" value="testing">
<input type="submit" value="submit">
</form>
which RESPONDS with the following:
<script language="Javascript">
document.domain = 'megaupload.com';
parent.downloadurl = 'http://www.megaupload.com/?d=27YR4U2Q';
parent.progress = '00:00:00 - 2.18 KB of 2.18 KB';
parent.uploaddone();
</script>
However, if i try to use php to achieve the same effect using a remote server with the code below (yes the test.txt file exists in the same dir):
<?
$postData['UPLOAD_IDENTIFIER'] = "41594851.1121416422";
$postData['sessionid'] = "41594851.1121416422";
$postData['file'] = "@.txt";
$postData['message'] = "testing";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www27.megaupload.com/upload_done.php?UPLOAD_IDENTIFIER=41594851.1121416422");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); // User-agent
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_REFERER, "");
$response = curl_exec($ch);
$response = htmlspecialchars($response);
echo "<pre>".$response."</pre>";
curl_close($ch);
?>
i cannot achive the same reponse as above. it simply returns <pre></pre>
if anyone can achieve the same effect as the response from the first bit of code, i would be grateful.
thank you.