欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己亲自做的 curl put 有大用 有大大用 有大大大用

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://10.11.11.11:9060/ers/config/endpoint/a02415b0-b1c0-11ed-bb89-ba4b9ac1fdce");

$name = 'aaaa';
$pwd = 'bbbbbbb';

$str = '{
       "ERSEndPoint" : {
       "id" : "a02415b0-b1c0-11ed-bb89-ba4b9ac1fdce",
       "groupId" : "ca316830-b4d6-11ed-bb89-ba4b9ac1fdce"
      }
    }';
$headers  =  array('Authorization:Basic '.base64_encode("$name:$pwd"),'Accept: application/json','ERS-Media-Type: identity.endpoint.1.1' ,'Content-Type: application/json');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // to resolve your current error
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
$response = curl_exec($ch);
if (curl_error($ch)) {
   $error_msg = curl_error($ch);
   var_dump("Error");
   var_dump($error_msg);exit;
}
curl_close($ch);
var_dump("AAAAAAAAAAA");
var_dump($response);


?>


普通分类: