Curl https://xxx.com/manage/json-rpc/xxxxxxx--header ' xxxxcxxxx-api-key:00000000 '--data ' {"JSONRPC": "2.0", "id": 1, "Method": "Push.send", "params": {"Pushprojectid": "XXXXXXX", "Platform": "ios", "Target": "Debugger", "BuildType": " Debug "," "Message": "Manage Sample", "JSON": "{\" url\ ": \" Http://www.baidu.com\ "}", "Deviceidlist": ["DDDDDDDDDDDDDDD"] }}'
如何利用PHP发送这条curl指令? 网上研究了半天毫无进展
Reply content:
Curl https://xxx.com/manage/json-rpc/xxxxxxx--header ' xxxxcxxxx-api-key:00000000 '--data ' {"JSONRPC": "2.0", "id": 1, "Method": "Push.send", "params": {"Pushprojectid": "XXXXXXX", "Platform": "ios", "Target": "Debugger", "BuildType": " Debug "," "Message": "Manage Sample", "JSON": "{\" url\ ": \" Http://www.baidu.com\ "}", "Deviceidlist": ["DDDDDDDDDDDDDDD"] }}'
如何利用PHP发送这条curl指令? 网上研究了半天毫无进展
First of all, I think your --data
content should be wrong.
Then you either use it directly exec
: http://php.net/manual/zh/function.exec.php
Or simply use PHP's CURL library: http://php.net/manual/zh/function.curl-setopt.php
$curl = curl_init('https://xxx.com/manage/json-rpc/xxxxxxx');curl_setopt( $curl, CURLOPT_HTTPHEADER, array("xxxxcxxxx-API-Key: 00000000") );curl_setopt( $curl, CURLOPT_POSTFILESD, array( "jsonrpc" => "2.0" ) );curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);$res = curl_exec( $curl );curl_close( $curl );