Aucune description

OapiTest.php 492B

123456789101112
  1. <?php
  2. include "TopSdk.php";
  3. date_default_timezone_set('Asia/Shanghai');
  4. $c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
  5. $req = new OapiMediaUploadRequest;
  6. $req->setType("image");
  7. $req->setMedia(array('type'=>'application/octet-stream','filename'=>'image.png', 'content' => file_get_contents('/Users/test/image.png')));
  8. $resp=$c->execute($req, "******","https://oapi.dingtalk.com/media/upload");
  9. var_dump($resp)
  10. ?>