Username: Password:

Author Topic: Content-Type=multipart/form-data PROBLEM - SOLVED  (Read 3820 times)

mature

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Content-Type=multipart/form-data PROBLEM - SOLVED
« on: December 21, 2010, 10:00:32 am »
i am trying make a service for a site that accept datas as Content-Type=multipart/form-data.
so can anyone give me an advice pls??

advices may be in perl and php

Example POSTDATA:
Code: [Select]
-----------------------------9003259118762
Content-Disposition: form-data; name="action"

send
-----------------------------9003259118762
Content-Disposition: form-data; name="typ"

2
-----------------------------9003259118762
Content-Disposition: form-data; name="rcpt"

1662807xxxx
-----------------------------9003259118762
Content-Disposition: form-data; name="text"

message text is here
-----------------------------9003259118762
Content-Disposition: form-data; name="remlen"

123


-----------------------------9003259118762--
« Last Edit: December 23, 2010, 08:50:35 am by mature »

mature

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: Content-Type=multipart/form-data PROBLEM
« Reply #1 on: December 22, 2010, 09:08:25 am »
do you think is the codes may be true? am i on way?

Code: [Select]
$srand = substr(md5(rand(0,32000)),0,10);
$aform =      "----$srand\r\n";

$submitdata = $aform;
$submitdata .= "Content-Disposition: form-data; name=\"title\"\r\n\r\n";
$submitdata .= "$title";
$submitdata .= "\r\n".$aform;
$submitdata .= "Content-Disposition: form-data; name=\"bodytext\"\r\n\r\n";
$submitdata .= "$body";
$submitdata .= "\r\n"."----$srand"."--\r\n";

$postdata = $submitdata;
$posturl = "http://test.com/submit.php";
 $ch = curl_init($posturl);
 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "Content-Type: multipart/form-data; boundary=--$srand");
 curl_setopt($ch, CURLOPT_POST      ,1);
 curl_setopt($ch, CURLOPT_POSTFIELDS    ,$postdata);
 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,0);
 curl_setopt($ch, CURLOPT_COOKIE,  $mycookies);
 curl_setopt($ch, CURLOPT_HEADER      ,1);  // DO NOT RETURN HTTP HEADERS
 curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  // RETURN THE CONTENTS OF THE CALL
 $return = curl_exec($ch);
 curl_close($ch);

mature

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: Content-Type=multipart/form-data PROBLEM - SOLVED
« Reply #2 on: December 23, 2010, 08:50:21 am »
actually we dont need these. only post like a normal form and it works. sorry it is my bad...