예제 #1
0
function turk50_hit($title, $description, $money, $url, $duration, $lifetime, $qualification, $maxAssignments, $keywords, $AutoApprovalDelayInSeconds)
{
    global $DEBUG, $SANDBOX, $AccessKey, $SecretKey;
    if ($SANDBOX) {
        $turk50 = new Turk50($AccessKey, $SecretKey);
    } else {
        $turk50 = new Turk50($AccessKey, $SecretKey, array("sandbox" => FALSE));
    }
    // prepare ExternalQuestion
    $Question = "<ExternalQuestion xmlns='http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd'>" . "<ExternalURL>{$url}</ExternalURL>" . "<FrameHeight>600</FrameHeight>" . "</ExternalQuestion>";
    // prepare Request
    $Request = array("Title" => $title, "Description" => $description, "Question" => $Question, "Reward" => array("Amount" => $money, "CurrencyCode" => "USD"), "AssignmentDurationInSeconds" => $duration, "LifetimeInSeconds" => $lifetime, "QualificationRequirement" => $qualification, "MaxAssignments" => $maxAssignments, "Keywords" => $keywords, "AutoApprovalDelayInSeconds" => $AutoApprovalDelayInSeconds);
    // invoke CreateHIT
    $CreateHITResponse = $turk50->CreateHIT($Request);
    // $hitId = $CreateHITResponse->HIT->HITId;
    // $assignId = turk_easyHitToAssn($hitId);
    return $CreateHITResponse;
}
예제 #2
0
//$GetAccountBalanceResponse = $turk50->GetAccountBalance();
//print_r($GetAccountBalanceResponse);
//$Amount = $GetAccountBalanceResponse->GetAccountBalanceResult->AvailableBalance->Amount;
//echo($Amount);
// prepare ExternalQuestion
$Question = "<ExternalQuestion xmlns='http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd'>" . "<ExternalURL>https://www.google.com</ExternalURL>" . "<FrameHeight>400</FrameHeight>" . "</ExternalQuestion>";
// prepare Request
$Request = array("Title" => "Kenneth 20150114 8", "Description" => "Bar", "Question" => $Question, "Reward" => array("Amount" => "0.01", "CurrencyCode" => "USD"), "AssignmentDurationInSeconds" => "300", "LifetimeInSeconds" => "300");
// invoke CreateHIT
//echo("<html><body>");
$numAssignment = 10;
$sleepInSec = 2;
echo "<p>numAssignment: {$numAssignment}</p>";
echo "<p>sleepInSec: {$sleepInSec}</p>";
$beginTime = time();
for ($i = 0; $i < $numAssignment; $i++) {
    $CreateHITResponse = $turk50->CreateHIT($Request);
    //print_r($CreateHITResponse);
    //echo("<p>");
    if ($i < $numAssignment - 1) {
        sleep($sleepInSec);
    }
}
$endTime = time();
$timeSpent = $endTime - $beginTime;
echo "<p>{$timeSpent} sec</p>";
?>


</html></body>