How to use php to write an interface for an xml format and a server address-php Tutorial

Source: Internet
Author: User
Tags php write what interface
For an xml format and a server address, how can I use the php write interface? I am writing it recently. I do not know how the experts will write it. I want to learn ^ ............ ------ Solution -------------------- what interface should be provided? ------ Solution ------------------ This is the data submission, and the call is simple. directly fso_get_contents, and then analyze the xml. $ url & quot; h is used to give an xml format and a server address, how to use the php write interface
I have been writing about it recently. I don't know how to write it. I want to learn it.
^ ............

------ Solution --------------------
What is the interface?
------ Solution --------------------
This is data submission. the call is simple. you can directly use fso_get_contents and then analyze the xml.
$ Url = "https://xxx.com/xml ";

$ Ch = curl_init ($ url );
$ Headers = array (
"POST". $ url. "HTTP/1.0 ",
"Content-type: text/xml; charset = \" UTF-8 \"",
"Accept: text/xml ",
"Content-length:". strlen ($ xmlcontent ),
);
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 60 );
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ headers );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, 0 );

// Apply the XML to our curl call
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ xmlcontent );

$ Data = curl_exec ($ ch );
If (curl_errno ($ ch )){
Die ('meeting information error. it is possible that the meeting has not started yet! ');
Exit;
} Else {
// Show me the result
// Var_dump ($ data );
Curl_close ($ ch );
}
------ Solution --------------------
Discussion

What Port does php connect? Is it a male or a mother?

Public data
Output xml for Analysis by others as the mother

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.