EDIT ........
This is NOT the question as posted. The context has been changed by @miken32, thank you for that. It appears this was done so the same person could say this is a duplicate of a "similar" question, but is not. It is reasonable to ensure one is doing Part A correctly before trying to do part B , which may also lead to Part C.
The suggested "duplicte" does not contain a full answer as was the same problem I originally expressesed in my original post. that has been edited to death. Not one example shown that I saw there has a POST command in it.The answers are incomplete. It is not the reply for a cURL POST , and the structure of the code is somewhat different. If I were and expert I would not be asking! Sure I can go and get a reply but need the reply for my POST.
There is no logic in removing half or more of the text in my original question regardless of how many points you have or make. in fact what was left has completely changed the question and does not help me to ensure part A is correct before moving on to part B. There is even a reply as to the header being incorrect but that portion of post has now been removed. Obviously that post was made before the edit. What now remains is a seemingly irrelevant reply . Oh and othanks again.
I ask that whoever does these , be a little more considerate of the poster rather than making the question what you WANT it to be.
I think I will be posting less on stackanything or serveranything and more in other places. This is not the first time and it is completely disrespectful to the original post!
I hoped to find some guidance here and only got frustration.
EDIT........................................
I am. trying to upload a file to a page that responds with an HTTP 201 Created
message and a Location
header. I need to get the value of that header.
$request = curl_init('http://localhost:80/eSCL/ScanJobs');
// send a file
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => '@' . realpath('ScanSettings.xml')
));
// output the response
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
This works but does not get me the header value I want.