PHP handling post raw data related issues ()

Source: Internet
Author: User
PHP handles post raw data issues (online, etc.)
XX software, go to connect hxxp://www.test.com/input.php
When the communication is connected, this XX software sends a text file such as: Abc.txt
Then after the PHP operation, back a section of Jason String to the software, and finally the software to run the corresponding function.

If this XX software sends Abc.txt (content Verify,deny,not commit and so on information), the PHP operation returns {"id": xxx, "url": "XXX", "port": "XXX"}


How should this PHP be written?

I try to receive abc.txt using Php://input, but what should I do after I receive it, and how do I return the string in Jason format after processing?

Please expert guidance, thanks!

Share to:


------Solution--------------------
I'm not going to give you a head!
------Solution--------------------
PHP received the file information will exist in the $_file global array inside, and then through Move_uploaded_file to move the TXT file to the server, and then use file_get_contents to get the contents of txt, and then the content processing, produce JSON, Finally echo the JSON
------Solution--------------------
$t = Array_diff (file (' Kkk.txt ', file_ignore_new_lines), file (' Abc.txt ', file_ignore_new_lines));


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.