request() 공개 메소드

public request ( $url, $post = false, $options = [] )
예제 #1
0
        foreach ($only as $key) {
            $data[$key] = $form[$key];
        }
    } else {
        $data = $form;
        // remove those fields specified in 'except'
        foreach (a::get($actionOptions, 'except', array()) as $key) {
            unset($data[$key]);
        }
    }
    $params = a::get($actionOptions, 'params', array());
    // merge the optional 'static' data from the action array with the form data
    $params['data'] = array_merge(a::get($params, 'data', array()), $data);
    $headers = array('Content-Type: application/x-www-form-urlencoded');
    $params['headers'] = array_merge(a::get($params, 'headers', array()), $headers);
    $response = remote::request($url, $params);
    if ($response->error === 0) {
        return array('success' => true, 'message' => l::get('uniform-webhook-success'));
    } else {
        return array('success' => false, 'message' => l::get('uniform-webhook-error') . $response->message);
    }
};
/*
 * Action to choose from multiple recipients who should receive the form by
 * email.
 */
uniform::$actions['email-select'] = function ($form, $actionOptions) {
    $allowed = a::get($actionOptions, 'allowed-recipients');
    if (!is_array($allowed)) {
        throw new Exception('Uniform email select action: No allowed recipients!');
    }