• Resolved kmadenski

    (@kmadenski)


    Hi guys. Thanks for epic plugin.

    It is possible to add HTTPHEADER? Need to authorization.

    Best regards

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kmadenski

    (@kmadenski)

    Maybe someone will need:
    I found this code in cf7-to-api/includes/class-cf7-api-admin.php

    
    $args = array(
                    'timeout'     => 5,
                    'redirection' => 5,
                    'httpversion' => '1.0',
                    'user-agent'  => 'WordPress/' . $wp_version . '; ' . home_url(),
                    'blocking'    => true,
                    'headers'     => array(),
                    'cookies'     => array(),
                    'body'        => null,
                    'compress'    => false,
                    'decompress'  => true,
                    'sslverify'   => true,
                    'stream'      => false,
                    'filename'    => null
                );
    

    I set
    'headers' => array()
    on:
    'headers' => array(htmlspecialchars("authorization: Token <your_64_char_api_key>"),"content-type: application/json"),

    • This reply was modified 7 years ago by kmadenski.
    Plugin Author Qube One ltd

    (@querysolutions)

    This is not a recommended approach because your changes will be deleted once you update the plugin

    You can add the following to your functions.php file

    add_filter( ‘qs_cf7_api_get_args’ , ‘add_http_header’ , 10 , 1);

    function add_http_header( $args ){
    $args[‘headers’] = array(
    htmlspecialchars(“authorization: Token
    <your_64_char_api_key>”),”content-type: application/json”);

    return $args;
    }

    I’m trying to use this snippet and am having trouble. Am required to use a Bearer token for this particular API, and still getting 401 errors no matter what I do. Is there an easier way to access the header for an API request sent from this plugin?

    I too am trying to use the snippet in my functions.php and it makes the website a blank page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HTTPHEADER – how?’ is closed to new replies.