This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Alexis Gruet | |
* | |
* A simple implementation of the Weighted Round-Robin Scheduling in PHP 5.3+ | |
* | |
* The weighted round-robin scheduling is designed to better handle servers with different | |
* processing capacities. Each server can be assigned a weight, an integer value that | |
* indicates the processing capacity. Servers with higher weights receive new connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Todo: Send a random user agent string and sleep a random amount between requests. | |
*/ | |
if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
// Extract and sanatize input: | |
$domain = filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_URL); | |
$terms = filter_input(INPUT_POST, 'terms', FILTER_SANITIZE_STRING); | |
// Setup Goutte (which also includes Guzzle): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple AJAX Polling jQuery Plugin | |
// example usage: | |
/* $.ajaxPoll({ | |
url: "/path", | |
type: "GET", | |
interval: 250, | |
maxAttempts: 25, | |
successCondition: function(result) { | |
return result != "processing"; | |
}, |
NewerOlder