Using PHP to store results of a post request -
IM is currently working with an API for which we can use XML The details must be sent to your server.
There is nothing bigger there but it is not working, so I want to output the XML sent to a text file so that's what I'm actually sending!
Instead of posting, API IM targets posting for a document, but XML looks really wrong in outputting its recordings. This is my target script, note that posting script 3 The item posts, so the description of each post request in the written file should be one after the other.
& lt ;? Php error_reporting (E_ALL); Ini_set ('display_errors', 1); // Get Request Data ... $ payload = ''; $ Fp = fopen ('php: // input', 'r'); $ Output_file = fopen ('output.txt', 'w'); While (FIF ($ FP)) {$ payload. = Fgets ($ fp); FILIT ($ output_file, $ payload); } Fclose ($ fp); Fclose ($ output_file); ? & Gt;
I also tried the following, but this last post request was filed so that all the 3
< Was entered in> output_file = FOPAN ('output.txt', 'wa'); While (FIF ($ FP)) {$ payload. = Fgets ($ fp); } FILIT ($ output_file, $ payload); Fclose ($ FP); Fclose ($ output_file);
I know that I'm really missing something, but it's all watching morning!
change
$ output_file = fopen ('output.txt' , 'W');
to
$ output_file = fopen ('output.txt', 'a');
In addition, replace
$ payload. = Fgets ($ fp);
to
$ payload = fgets ($ fp);
Comments
Post a Comment