code/api/MetadataPushApi.php
/**
     * Makes a curl request to the catalogue and returns the response.
     *
     * @param  Array  $headers
     * @param  String  $body
     *
     * @return Array
     */
Makes a curl request to the catalogue and returns the response.
@param  Array  $headers
@param  String  $body

@return Array
Makes a curl request to the catalogue and returns the response . @param Array $headers @param String $body @return Array
public function makeCurlRequest($headers, $body)
    {
        $output = "";
        $statusCode = 0;
        $curlError = "";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->cataloguePushUrl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if ($this->catalogueUsername && $this->cataloguePassword) {
            curl_setopt($ch, CURLOPT_USERPWD, $this->catalogueUsername . ':' . $this->cataloguePassword);
        }
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
        $output = curl_exec($ch);
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $curlError = curl_error($ch);
        if (curl_error($ch) !== '' || $statusCode == 0) {
            $statusCode = 500;
        }
        curl_close($ch);
        return array($output, $statusCode, $curlError);
    }
public function makeCurlRequest ( $ headers , $ body ) { $ output = " " ; $ statusCode = 0 ; $ curlError = " " ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ this -> cataloguePushUrl ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; if ( $ this -> catalogueUsername && $ this -> cataloguePassword ) { curl_setopt ( $ ch , CURLOPT_USERPWD , $ this -> catalogueUsername . ':' . $ this -> cataloguePassword ) ; } curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ body ) ; $ output = curl_exec ( $ ch ) ; $ statusCode = curl_getinfo ( $ ch , CURLINFO_HTTP_CODE ) ; $ curlError = curl_error ( $ ch ) ; if ( curl_error ( $ ch ) !== '' || $ statusCode == 0 ) { $ statusCode = 500 ; } curl_close ( $ ch ) ; return array ( $ output , $ statusCode , $ curlError ) ; }
Makes a curl request to the catalogue and returns the response.
Makes a curl request to the catalogue and returns the response .
// create curl resource // set url // return the transfer as a string // If a username and password exist then add them as basic auth. // Set headers and body. // Execute the curl command and get the output. // Get the status code. // Get a curl error if there is one // Normalise the status code // close curl resource to free up system resources // Return the output, status code, and curl error