Title: HTTPHEADER &#8211; how?
Last modified: November 12, 2017

---

# HTTPHEADER – how?

 *  Resolved [kmadenski](https://wordpress.org/support/users/kmadenski/)
 * (@kmadenski)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/httpheader-how/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhttpheader-how%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [kmadenski](https://wordpress.org/support/users/kmadenski/)
 * (@kmadenski)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/httpheader-how/#post-9685303)
 * 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 8 years, 4 months ago by [kmadenski](https://wordpress.org/support/users/kmadenski/).
 *  Plugin Author [Qube One ltd](https://wordpress.org/support/users/querysolutions/)
 * (@querysolutions)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/httpheader-how/#post-9702382)
 * 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;
    }
 *  [AnalogWalrus](https://wordpress.org/support/users/analogwalrus/)
 * (@analogwalrus)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/httpheader-how/#post-10017978)
 * 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?
 *  [legalaiddc](https://wordpress.org/support/users/legalaiddc/)
 * (@legalaiddc)
 * [8 years ago](https://wordpress.org/support/topic/httpheader-how/#post-10129427)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/cf7-to-api.svg)
 * [Contact form 7 TO API](https://wordpress.org/plugins/cf7-to-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-to-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-to-api/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-to-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-to-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-to-api/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [legalaiddc](https://wordpress.org/support/users/legalaiddc/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/httpheader-how/#post-10129427)
 * Status: resolved