src/Client.php
public function submit(LongLog $longLog)
    {
        // Request example: POST http://api.longlog.ru/project/log
        $curl = curl_init($this->getEndpointUrl() . '/project/log');
        curl_setopt($curl, CURLOPT_HTTPHEADER, [
            'Content-Type: application/json',
        ]);
        curl_setopt($curl, CURLOPT_TIMEOUT, $this->getTimeout());
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->getRequestBody($longLog)));

        curl_exec($curl);
        $statusCode = (int)curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        return $statusCode === 201;
    }
public function submit(LongLog $longLog)
    {
        // Request example: POST http://api.longlog.ru/project/log
        $curl = curl_init($this->getEndpointUrl() . '/project/log');
        curl_setopt($curl, CURLOPT_HTTPHEADER, [
            'Content-Type: application/json',
        ]);
        curl_setopt($curl, CURLOPT_TIMEOUT, $this->getTimeout());
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->getRequestBody($longLog)));

        curl_exec($curl);
        $statusCode = (int)curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        return $statusCode === 201;
    }
public function submit ( LongLog $ longLog ) { // Request example: POST http://api.longlog.ru/project/log $ curl = curl_init ( $ this -> getEndpointUrl ( ) . '/project/log' ) ; curl_setopt ( $ curl , CURLOPT_HTTPHEADER , [ 'Content-Type: application/json' , ] ) ; curl_setopt ( $ curl , CURLOPT_TIMEOUT , $ this -> getTimeout ( ) ) ; curl_setopt ( $ curl , CURLOPT_SSL_VERIFYHOST , false ) ; curl_setopt ( $ curl , CURLOPT_SSL_VERIFYPEER , false ) ; curl_setopt ( $ curl , CURLOPT_POST , true ) ; curl_setopt ( $ curl , CURLOPT_POSTFIELDS , json_encode ( $ this -> getRequestBody ( $ longLog ) ) ) ; curl_exec ( $ curl ) ; $ statusCode = ( int ) curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; curl_close ( $ curl ) ; return $ statusCode === 201 ; }
Send log to API

@param LongLog $longLog

@return bool TRUE if log successfully saved
Send log to API