lib/Elastica/Util.php
public static function convertRequestToCurlCommand(Request $request)
    {
        $message = 'curl -X'.\strtoupper($request->getMethod()).' ';
        $message .= '\'http://'.$request->getConnection()->getHost().':'.$request->getConnection()->getPort().'/';
        $message .= $request->getPath();

        $query = $request->getQuery();
        if (!empty($query)) {
            $message .= '?'.\http_build_query($query);
        }

        $message .= '\'';

        $data = $request->getData();
        if (!empty($data)) {
            $message .= ' -d \''.JSON::stringify($data).'\'';
        }

        return $message;
    }
public static function convertRequestToCurlCommand(Request $request)
    {
        $message = 'curl -X'.\strtoupper($request->getMethod()).' ';
        $message .= '\'http://'.$request->getConnection()->getHost().':'.$request->getConnection()->getPort().'/';
        $message .= $request->getPath();

        $query = $request->getQuery();
        if (!empty($query)) {
            $message .= '?'.\http_build_query($query);
        }

        $message .= '\'';

        $data = $request->getData();
        if (!empty($data)) {
            $message .= ' -d \''.JSON::stringify($data).'\'';
        }

        return $message;
    }
public static function convertRequestToCurlCommand ( Request $ request ) { $ message = 'curl -X' . \ strtoupper ( $ request -> getMethod ( ) ) . ' ' ; $ message .= '\'http://' . $ request -> getConnection ( ) -> getHost ( ) . ':' . $ request -> getConnection ( ) -> getPort ( ) . '/' ; $ message .= $ request -> getPath ( ) ; $ query = $ request -> getQuery ( ) ; if ( ! empty ( $ query ) ) { $ message .= '?' . \ http_build_query ( $ query ) ; } $ message .= '\'' ; $ data = $ request -> getData ( ) ; if ( ! empty ( $ data ) ) { $ message .= ' -d \'' . JSON :: stringify ( $ data ) . '\'' ; } return $ message ; }
Converts Request to Curl console command.

@param Request $request

@return string
Converts Request to Curl console command .