[Codephp] $ serviceURL & #39; 61.153.225.106: 5678Service. asmxtests & #39; $ chcurl_init ($ serviceURL); curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, & quot; POST & quot;); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($ ch, CURL http protocol jsonphpcurl
[Code = php] $ serviceURL = 'http: // 61.153.225.106: 5678/Service. asmx/tests ';
$ Ch = curl_init ($ serviceURL );
Curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, "POST ");
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ strjson); // All data is sent using the http post operation.
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array (
'Content-Type: application/json; charset = utf-8 ;',
'Content-Length: '. strlen ($ strjson)
));
Curl_setopt ($ ch, CURLOPT_POST, 1 );
$ Result = curl_exec ($ ch );
$ ErrorNo = curl_errno ($ ch );
Echo $ errorNo ."
"; // Error code output 0
Echo "error:". curl_error ($ ch );
Echo $ result ."
"; // Execution information error
Curl_close ($ ch); [/code]
Json string: {"ccode": "1234ew4", "ddate": "2015-12-16", "ccuscode": "0100001", "cinvcode": "100101", "iquantity ": "1", "address": "Test address", "cmemo": "None", "cmaker": "demo", "cverifer": "demo ", "dpredate": "2015-12-17", "imoney": "1 "}
The ccode needs to be changed, and the same insert is not included.
Error message
[Img = Beijing
Because data is inserted to a third party, the upload format cannot be changed. only json format can be uploaded.
In addition, if you enter http: // 61.153.225.106: 5678/Service. asmx/tests in the webpage, then you can input a string to return a string. After the transfer protocol is complete, I want to see if it is a problem. However, I actually transmit data whose content-type is json. Please kindly advise, only 12 points for all