Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

<?php echo $_SERVER['HTTP_HOST'];
@jameshadley
jameshadley / cf-invalidate.php
Created April 18, 2017 11:34 — forked from claylo/cf-invalidate.php
How to invalidate items in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php
/**
* @param $app
* @return int:
* -4: Error
* -3: Googlebot
* -2: Found locally, not a VPN
* -1: Looked up, not a VPN
* 1: Looked up, VPN
* 2: Found locally, VPN
*/
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *_afHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
// set your response content type here
NSMutableSet *contentTypes = [[NSMutableSet alloc] init];
[contentTypes addObject:@"application/json"];
_afHTTPSessionManager.responseSerializer.acceptableContentTypes = contentTypes;
[_afHTTPSessionManager.requestSerializer setAuthorizationHeaderFieldWithUsername:username password:password];