now the problem is here that i got only "1" and thanks God not access denide message. script is
<?php
function parse_response($this_response)
{
// Split response into header and body sections
list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
$response_header_lines = explode("\r\n", $response_headers);
// First line of headers is the HTTP response code
$http_response_line = array_shift($response_header_lines);
if(preg_match('@HTTP/[0-9].[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
// put the rest of the headers in an array
$response_header_array = array();
foreach($response_header_lines as $header_line)
{
list($header,$value) = explode(': ', $header_line, 2);
$response_header_array[$header] .= $value."\n";
}
return array("code" => $response_code, "header" => $response_header_array, "body" => $response_body);
}
// Do transfer, and make sure to include header in response
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.mydomain.com/account");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
// Parse the response message
$response = parse_response($response);
echo print_r($response);
echo " end response<br>";
// Create the basic header
$this_header = array(
"MIME-Version: 1.0",
"Content-type: text/html; charset=iso-8859-1",
"Content-transfer-encoding: text"
);
// Add each cookie that has been returned in the response
// If cookies need to be added/deleted or value changed, then add code here
$cookies = explode("\n", $response["header"]["Set-Cookie"]);
//print_r($cookies);
//echo " end cookies<br>";
foreach($cookies as $this_cookie) { array_push($this_header, "Cookie: ".$this_cookie); }
//print_r($this_cookie);
//echo " end this_cookies<br>";
// Next set of transfers
$data="msgidlist=Get+Message-IDs&dupes=on&46058397=on";
$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, "http://www.mydomain.com/account");
curl_setopt($ch, CURLOPT_URL, "http://www.mydomain.com/browse/post/1078143/database/post/edit/?ps_id=1087422&msgidlist=Get+Message-IDs&dupes=on&46058397=on");
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cook");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cook");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
$response = curl_exec($ch);
curl_close($ch);
print $response;
?>
but the last print $response give only 1 ... since they must give me a file here.
In my script first i got cookies infromation for $this_header and then using it and also cook cookingjar and try to download file but i got only 1.
Please see the script and tell me where i am going wrong are what i have to do for taking file in $response.