Title: URL HTTP header?
Last modified: December 14, 2018

---

# URL HTTP header?

 *  Resolved [gbeddow](https://wordpress.org/support/users/gbeddow/)
 * (@gbeddow)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/url-http-header/)
 * Hi, I’m interested in your wp-all-import plugin, and was wondering if there’s
   a way to put data into the HTTP header before making the request to import from
   a URL? The XML feed I need to import from has certain requirements for setting
   an API key, etc. into the HTTP header before making the request. Thanks!

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/url-http-header/#post-10993508)
 * Hey [@gbeddow](https://wordpress.org/support/users/gbeddow/)
 * Yes, you can use the http_api_curl hook for this: [https://developer.wordpress.org/reference/hooks/http_api_curl/](https://developer.wordpress.org/reference/hooks/http_api_curl/).
   Here´s an example snippet that you can adjust as needed:
 *     ```
       add_action( 'http_api_curl', 'my_curl_header', 10, 3 );
   
       function my_curl_header( $handle, $r, $url ) {
           if ( $url == 'http://example.com/path/to/feed/file.xml' ) {
   
               curl_setopt( $handle, CURLOPT_HTTPHEADER, array(
                   'authorization: Token mytoken',
                   'Content-Type: application/json'
               ) );
   
           }
       }
       ```
   
 *  Thread Starter [gbeddow](https://wordpress.org/support/users/gbeddow/)
 * (@gbeddow)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/url-http-header/#post-10993788)
 * Great [@wpallimport](https://wordpress.org/support/users/wpallimport/). I haven’t
   had a chance to try it yet, but it looks like this is just the ticket! Thanks.

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

The topic ‘URL HTTP header?’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

## Tags

 * [http-header](https://wordpress.org/support/topic-tag/http-header/)

 * 2 replies
 * 2 participants
 * Last reply from: [gbeddow](https://wordpress.org/support/users/gbeddow/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/url-http-header/#post-10993788)
 * Status: resolved