public static function addLogo($token, $domain, $file, &$error) { $http = new \Bitrix\Main\Web\HttpClient(); $boundary = 'CMY' . md5(rand() . time()); $data = ''; $data .= '--' . $boundary . "\r\n"; $data .= 'Content-Disposition: form-data; name="token"' . "\r\n\r\n"; $data .= $token . "\r\n"; $data .= '--' . $boundary . "\r\n"; $data .= 'Content-Disposition: form-data; name="domain"' . "\r\n\r\n"; $data .= $domain . "\r\n"; $data .= '--' . $boundary . "\r\n"; $data .= 'Content-Disposition: form-data; name="file"; filename="file"' . "\r\n"; $data .= 'Content-Type: application/octet-stream' . "\r\n\r\n"; $data .= file_get_contents($file) . "\r\n"; $data .= '--' . $boundary . "--\r\n"; $http->setHeader('Content-type', 'multipart/form-data; boundary=' . $boundary); $http->setHeader('Content-length', CUtil::binStrlen($data)); $response = $http->post('https://pddimp.yandex.ru/api/add_logo.xml', $data); $result = new CDataXML(); $result->loadString($response); if ($logoUrlNode = $result->selectNodes('/action/domains/domain/logo/url')) { return $logoUrlNode->textContent(); } self::setError2($result, $error); return false; }