Skip to content

Instantly share code, notes, and snippets.

@netdna
netdna / gist:2501099
Created April 26, 2012 17:22
nginx - return a 403 response for certain referers
#place this in nginx.conf or a vhosts
if ($http_referer ~* (keyword|domain.com|www.domain.com))
{ return 403; }
#!/usr/bin/perl -w
#NetDNA API Sample Code - Perl
#Version 1.0a
use strict;
use JSON;
use Net::OAuth;
use LWP::UserAgent;
use URI;
$ php netdna_api_console.php http://staging.rws.netdna.com/company_alias/account.json true
<?php //vim: foldmethod=marker
//require_once("OAuth.php");
class TestOAuthServer extends OAuthServer {
public function get_signature_methods() {
return $this->signature_methods;
}
}
class TestOAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod_RSA_SHA1 {
<?php
// vim: foldmethod=marker
/* Generic exception class
*/
class OAuthException extends Exception {
// pass
}
class OAuthConsumer {
<?php
// Download - https://gist.github.com/raw/2210583/64b7007ab9d4d4cbb77efd107bb45e16fc6c8cdf/OAuth.php
require_once("OAuth.php");
// Download - https://gist.github.com/raw/2210597/cdf6262b41e1de4562a020ad4cb371cbb9425f03/OAuthServer.php
require_once("OAuthServer.php");
$test_server = new TestOAuthServer(new MockOAuthDataStore());
$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
$plaintext_method = new OAuthSignatureMethod_PLAINTEXT();
<?php
/*
* NetDNA API Sample Code - PHP
* Version 1.0a
*/
// Get it here: https://raw.github.com/gist/2791330/64b7007ab9d4d4cbb77efd107bb45e16fc6c8cdf/OAuth.php
require_once("OAuth.php");