1
cURL을 사용하여 OneDrive Business AC 계정의 새 폴더에 JSON 파일을 업로드하려고합니다. 업로드하는 동안, 나는 다음과 같은 오류가 무엇입니까 :PHP-Curl을 사용하여 Office 365 Onedrive Business 계정에 파일 업로드
$headers = array('Content-Type: application/text', "Cache-Control: no-cache", "Pragma: no-cache", "Authorization: bearer ".$token);
과 패스로 : 헤더에 전달
$uri = "https://graph.microsoft.com/v1.0/me/drive/root/new/sample.json/content?access_token=accesstoken";
function curl_put($uri, $fp) {
$output = "";
try {
$pointer = fopen($fp, 'r+');
$stat = fstat($pointer);
$pointersize = $stat['size'];
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $pointer);
curl_setopt($ch, CURLOPT_INFILESIZE, (int) $pointersize);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
}
}
유익한 답변을 보내 주셔서 감사합니다. –