function defensio_post($action, $args = null) { global $defensio_conf; // Use snoopy to post require_once 'lib/class-snoopy.php'; $snoopy = new Snoopy(); $snoopy->read_timeout = $defensio_conf['post_timeout']; // Supress the possible fsock warning @$snoopy->submit(defensio_url_for($action, $defensio_conf['key']), $args, array()); // Defensio will return 200 nomally, 401 on authentication failure, anything else is unexpected behaivour if ($snoopy->status == 200 or $snoopy->status == 401) { return $snoopy->results; } else { return false; } }
function defensio_post($action, $defensio_conf, $args = null) { // Use snoopy to post if (file_exists(dirname(__FILE__) . '/libraries/Snoopy.class.php')) { require_once dirname(__FILE__) . '/libraries/Snoopy.class.php'; } else { require_once dirname(__FILE__) . '/libraries/snoopy.class.php'; } $snoopy = new Snoopy(); $snoopy->read_timeout = isset($defensio_conf['post_timeout']) ? $defensio_conf['post_timeout'] : ''; // Supress the possible fsock warning @$snoopy->submit(defensio_url_for($action, $defensio_conf, $defensio_conf['key']), $args, array()); // Defensio will return 200 nomally, 401 on authentication failure, anything else is unexpected behaivour if ($snoopy->status == 200 or $snoopy->status == 401) { return $snoopy->results; } else { return false; } }