JavaScript-read XML content using PHP or jquery

Source: Internet
Author: User
Tags form post

Now there is such a demand,

This is the information that I return from the form post number and key to a logistics company interface, how do I read the time, status, and other information in PHP or jquery and then display it on another HTML page? Urgent!!!

Reply content:

Now there is such a demand,

This is the information that I return from the form post number and key to a logistics company interface, how do I read the time, status, and other information in PHP or jquery and then display it on another HTML page? Urgent!!!

Http://www.runoob.com/php/func-simplexml-load-string.html
Http://www.w3school.com.cn/jquery/ajax_ajax.asp

---update---
If it is not possible to submit directly to the logistics site with Ajax (JSONP is rarely supported, it is impossible to submit the past.) )

Using a form to submit to your PHP program, the PHP program constructs the request content, curl requests to the logistics site, receives the returned XML, and parses the processing.

Or if the interface of the Logistics Web site supports the asynchronous return of the results can also.

Do you want to ask how to send HTTp requests in PHP?

function send_post($url, $post_data) {      $postdata = http_build_query($post_data);    $options = array(      'http' => array(        'method' => 'POST',        'header' => 'Content-type:application/x-www-form-urlencoded',        'content' => $postdata,        'timeout' => 15 * 60 // 超时时间(单位:s)      )    );    $context = stream_context_create($options);    $result = file_get_contents($url, false, $context);      return $result;  }

The above return value is the XML content above. Specific interfaces do not know, you can not write an example.

JQuery even if this is a cross-domain interface and does not support JSONP

Recommended for PHP Processing: PHP processing XML

  • 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.