D7 API documentation
What's New
Modules
Main module in old core
Legacy mode
PSR-18: HTTP Client
Asynchronous queries
CURL
Proxy
Logging
HttpClient constructor
HttpClient destuctor
disableSslVerification
download
get
getCharset
getContentType
getCookies
getEffectiveUrl
getError
getHeaders
getResult
getStatus
head
post
query
setAuthorization
setCharset
setCompress
setCookies
setHeader
setOutputStream
setProxy
setRedirect
setStreamTimeout
setTimeout
setVersion
waitResponse
OnHttpClientBuildRequest
Event is called after creating a query object. It allows to adjust client options and change query object (please, be advise that query object is unmodifiable and all modifications are made using the methods with...
). Query object is returned via the event type \Bitrix\Main\Web\Http\RequestEventResult
.
Example
\Bitrix\Main\EventManager::getInstance()->addEventHandler('main', 'OnHttpClientBuildRequest', 'MyOnHttpClientBuildRequest'); function MyOnHttpClientBuildRequest(\Bitrix\Main\Web\Http\RequestEvent $event) { $client = $event->getClient(); $client->setProxy(''); $request = $event->getRequest(); $request = $request->withHeader('MyHeader', 'MyValue'); $result = new \Bitrix\Main\Web\Http\RequestEventResult($request); $event->addResult($result); }
© «Bitrix24», 2001-2024
Up