Created
June 28, 2010 07:41
-
-
Save alfredwesterveld/455553 to your computer and use it in GitHub Desktop.
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 snippets for http://github.com/alfredwesterveld/java-schedule-broadcaster |
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 | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_URL, "http://localhost:8888/scheduler"); | |
curl_setopt($curl, CURLOPT_WRITEFUNCTION, 'progress'); | |
curl_exec($curl); | |
curl_close($curl); | |
function progress($curl, $str) { | |
print "$str\n"; | |
return strlen($str); | |
} |
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 | |
$url = 'http://localhost:8888/scheduler'; | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
while (true) { | |
$rnd = rand(1,10000); | |
$epoch = time() * 1000 + $rnd; | |
echo $rnd; | |
curl_setopt($ch,CURLOPT_POSTFIELDS, "message=$rnd&epoch=$epoch"); | |
curl_exec($ch); | |
sleep(2); | |
} | |
curl_close($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment