Curlxxx. commanagejson-rpcxxxxxxx -- header & #039; xxxxcxxxx-API-Key: 00000000 & #039; -- data & #039 ;{& quot; jsonrpc & quot ;:& quot; 2.0 & quot;, & quot; id & quot;: 1, & quot; method & quot;: & quot; Push. send & quot;, & quot; params & quot;: {& quot; pushProjectId & quot 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 ": ["ddddddddddddd"]}'
How can I use PHP to send this curl command? No progress has been made on the Internet for a long time
Reply content:
Curl https://xxx.com/manage/json-rpc/xxxxxxx -- header 'xxxxcxxxx-API-Key: 8080' -- data' {"jsonrpc": "00000000", "id": 1, "method": "Push. send "," params ": {" pushProjectId ":" XXXXXXX "," platform ":" ios "," target ":" debugger "," buildType ":" debug ", "message": "manage sample", "json": "{\" url \ ": \" http://www.baidu.com \ "}", "deviceIdList ": ["ddddddddddddd"]}'
How can I use PHP to send this curl command? No progress has been made on the Internet for a long time
First, I think your--data
The content should be wrong.
Then you can directly useexec
: Http://php.net/manual/zh/function.exec.php
Either directly use the PHP 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 );