Send XML data from one server to another server using Remote site () Whatever comments I have made, as well as separate header strings and file_get_contents ('php: // input') I am sending a test XML to ensure that the remote file will process incoming XML streams.
$ xmlcontent = "& lt ;? Xml version = \" 1.0 \ "? Gt; \ n & lt; English & gt; \ N & lt; zodiac & gt; \ n4500 $ .22 \ n & lt; / zodiac & gt; \ n & lt; / english & gt; "; $ Url = "https://www.example.info/xmlprocessor"; $ Opts = array ('http' = & gt; array ('method' = & gt; 'POST', 'header' = & gt; "content-type: text / xml", 'content' = & gt; $ Xmlcontent);) $ Context = stream_context_create ($ opts); $ Response = file_get_contents ($ url, incorrect, $ reference); // $ fp = fopen ($ url, 'r', false, $ reference); // fpassthru ($ FP); // fclose ($ FP);
$ response = simplexml_load_string (file_get_contents ('php: // input')); // $ response = simplexml_load_string (fopen ('php: // stdin', 'r')); // $ response = file_get_contents ('php: // input'); // $ response = $ _POST; $ Processed = json_encode ($ response); $ Result = $ db- & gt; Exec ("INSERT example (date, data) value ('$ time', '$ processed')");
'xml' = & gt; In addition to $ opts, xmlcontent
Additionally, I tried to use curls, which did not even run the remote script.
Comments
Post a Comment