Which of the following experts helped me adapt and use curl to call webservice-php?

Source: Internet
Author: User
Who helped me adapt and use curl to call webservice & lt ;? Php & nbsp; $ snewSoapClient (& quot; www. abc. comWebServicesService1.asmx? Wsdl & quot;, true); & nbsp; $ s-& gt; soap_defencodingUTF-8; & nbsp; $ s-who helped me adapt web service call with curl

$ S = new SoapClient ("http://www.abc.com/WebServices/Service1.asmx? Wsdl ", true );
$ S-> soap_defencoding = 'utf-8 ';
$ S-> decode_utf8 = false;
$ Result = $ s-> call ('userinfo', array ('user' => urldecode ($ _ GET ['username']);

If (! $ Err = $ s-> getError ()){
$ List = explode (";", $ result ["UserInfoResult"]);
Array_pop ($ list );
} Else {
Echo'

';
}
?>

Service1.asmx this web service has a UserInfo function. to pass the parameter to this function, return the result set.

This is a good idea, but the VM does not enable soap expansion, so you don't have to waste effort. how can we rewrite curl now?

------ Solution --------------------

------ Solution --------------------
$ Url = "https: // xxx/xml ";

$ Ch = curl_init ($ url );
$ Headers = array (
"POST". "https: // cxxx/integration/xml". "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 {
// Var_dump ($ data );
Curl_close ($ ch );
}
//
$ Succes = '';
$ CiURL = '';
$ Token = '';
$ Xml = simplexml_load_string ($ data );
$ CiURL = $ xml-> body-> ciURL;
$ Token = $ xml-> body-> token;
Var_dump ($ xml );

------ Solution --------------------
It is estimated that the landlord wants to close the link. Haha

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.