Skip to content

Basic curl implementation #23

@szepeviktor

Description

@szepeviktor

Please add it to the README.

function curl_get_contents( $url ) {

    if ( ! function_exists( 'curl_init' ) ) {
        return false;
    }

    $ch = curl_init();
    $timeout = 60;

    curl_setopt( $ch, CURLOPT_URL, $url );
    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    $response = curl_exec( $ch );
    curl_close( $ch );

    return $response;
}

// Instantiate the Message and Validator
$message = Message::fromRawPostData();
$validator = new MessageValidator( 'curl_get_contents' );

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions