PHP code example of pauly4it / laraturk
1. Go to this page and download the library: Download pauly4it/laraturk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pauly4it / laraturk example snippets
[
"OperationRequest" => [
"RequestId" => "ece2785b-6292-4b12-a60e-4c34847a7916"
],
"HIT" => [
"Request" => [
"IsValid" => "True"
],
"HITId" => "GBHZVQX3EHXZ2AYDY2T0",
"HITTypeId" => "NYVZTQ1QVKJZXCYZCZVZ"
]
]
$params = [
'HITTypeID' => '',
'HITLayoutId' => '',
'HITLayoutParameter' => [
[
'Name' => 'image_title',
'Value' => 'Some image'
],
[
'Name' => 'description',
'Value' => 'None'
]
],
'LifetimeInSeconds' => 300,
'MaxAssignments' => 3
];
$turk = new LaraTurk;
$response = $turk->forceExpireHIT($params);
[
"OperationRequest" => [
"RequestId" => "ece2785b-6292-4b12-a60e-4c34847a7916"
],
"HIT" => [
"Request" => [
"IsValid" => "True"
],
"HITId" => "GBHZVQX3EHXZ2AYDY2T0",
"HITTypeId" => "NYVZTQ1QVKJZXCYZCZVZ"
]
]
$turk = new LaraTurk;
$response = $turk->forceExpireHIT(['HITId' => '3AQGTY5GMKYZ11S8P0G0J0DRP0MU70']);
[
"OperationRequest" => [
"RequestId" => "ece2785b-6292-4b12-a60e-4c34847a7916"
],
"ForceExpireHITResult" => [
"Request" => [
"IsValid" => "True"
]
]
]
$params['Reward'] = [
'Amount' => 0.07,
'CurrencyCode' => 'USD',
'FormattedPrice' => '$0.07' // optional parameter
];
$params['HITLayoutParameter'] = [
[
'Name' => 'image_title',
'Value' => 'Some image'
],
[
'Name' => 'description',
'Value' => 'None'
]
];
$params['QualificationRequirement'] = [
[
'QualificationTypeId' => '00000000000000000071', // Worker locale qualification
'Comparator' => 'In',
'LocaleValue' => [
[
'Country' => 'US'
],
[
'Country' => 'CA'
]
] // located in the US or Canada
],
[
'QualificationTypeId' => '00000000000000000040', // Worker approved hits qualification
'Comparator' => 'GreaterThanOrEqualTo',
'IntegerValue' => '1000'
],
[
'QualificationTypeId' => '000000000000000000L0', // Worker approval percentage qualification
'Comparator' => 'GreaterThanOrEqualTo',
'IntegerValue' => '98'
]
];
$params['Notification'] = [
[
'Destination' => '[email protected] ',
'Transport' => 'Email',
'Version' => '2006-05-05',
'EventType' => [
'HITReviewable',
'HITExpired'
]
],
[
'Destination' => '[email protected] ',
'Transport' => 'Email',
'Version' => '2006-05-05',
'EventType' => [
'AssignmentAccepted'
]
]
];
...
catch(LaraTurkException $e)
{
// your code here
}
"Error" => [
"Code" => "AWS.NotAuthorized",
"Message" => "The identity contained in the request is not authorized to use this AWSAccessKeyId (5934433916915 s)"
]
xml
<CreateHITResponse>
<OperationRequest>
<RequestId>ece2785b-6292-4b12-a60e-4c34847a7916</RequestId>
</OperationRequest>
<HIT>
<Request>
<IsValid>True</IsValid>
</Request>
<HITId>GBHZVQX3EHXZ2AYDY2T0</HITId>
<HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
</HIT>
</CreateHITResponse>