Hello,
I want to post a file using cURL, I am not using the PUT verb.
Any ideas
function curl_connection($url, $header_array, $output_file, $print_to_file) {
$fp = fopen("C:\Inetpub\wwwroot\xml\php\Stock.txt", "r");
$session = curl_init($url);
$output_handle = fopen($output_file, "w");
curl_setopt($session, CURLOPT_HTTPHEADER, $header_array);
//curl_setopt($session, CURLOPT_VERBOSE, 1);
curl_setopt($session, CURLOPT_COOKIE, "x-main=YvjPkwfntqDKun0QEmVRPcTTZDMe?Tn?;ubid-main=002-8989859-9917520;ubid-tacbus=019-5423258-4241018;x-tacbus=vtm4d53DvX@Sc9LxTnAnxsFL3DorwxJa; ubid-tcmacb=087-8055947-0795529;ubid-ty2kacbus=161-5477122-2773524; session-id=087-178254-5924832; session-id-time=950660664");
if ($print_to_file == "1") {
curl_setopt($session, CURLOPT_FILE, $output_handle);
}
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($session, CURLOPT_POST, 1);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($session, CURLOPT_UPLOAD, 1);
//curl_setopt($session, CURLOPT_INFILE, $fp);
//curl_setopt($session, CURLOPT_INFILESIZE, filesize("C:\Inetpub\wwwroot\xml\php\Stock.txt"));
curl_setopt($session, CURLOPT_POST, 1);
if (!curl_exec($session)) {
curl_close($session);
return FALSE;
} else {
curl_close($session);
return TRUE;
}
}