Joel_Sisko
asked on
Post XML file to PHP...
Experts,
I am having a hard time understanding how to use a php script that will allow a third party application automatically "post" a small xml file to my server running the php script.
So the flow is: Client application--->xml file--->myphpscript--->dir ectory on my server.
Please no pointers to resources on the internet that are not complete solutions to the problem. I have been searching them all day already.
Thanks,
Joel
I am having a hard time understanding how to use a php script that will allow a third party application automatically "post" a small xml file to my server running the php script.
So the flow is: Client application--->xml file--->myphpscript--->dir
Please no pointers to resources on the internet that are not complete solutions to the problem. I have been searching them all day already.
Thanks,
Joel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It totally depends on how the xml is delivered to your script.
Your second example assumes that the xml is uploaded as a file upload (as part of a multipart post). The php://input approach assumes that the post data itself, is the actual xml string.
Your second example assumes that the xml is uploaded as a file upload (as part of a multipart post). The php://input approach assumes that the post data itself, is the actual xml string.
ASKER
Assume that the file being transfered was a text file or any file for that fact, would the above code allow that file to be posted and copied/moved to the directory stated in the code? My problem is I understand posting (barely) as it relates to a form that you manually click the submit button.
Thanks for the help so far.
Joel
Thanks for the help so far.
Joel
Your file with move_uploaded_file should be fine when the xml is uploaded using a form-like request.
ASKER
So are you saying it can not be posted to? How do I change it so it can be posted to?
Joel
Joel
ASKER
I am referring to something like this that I have seen:
<?
if(is_uploaded_file($_FILE
$folder = "/path/to/file/";
$count = count(glob($folder . "*")) + 1;
$ext = explode(".",$_FILES['filef
$filename = $folder . "rawfile" . $count . "." . $ext[1];
move_uploaded_file($_FILES
}//end if
?>