{"id":16410336,"url":"https://github.com/ctrlcctrlv/mturk-php","last_synced_at":"2025-08-28T06:13:12.769Z","repository":{"id":15006933,"uuid":"17732439","full_name":"ctrlcctrlv/mturk-php","owner":"ctrlcctrlv","description":"Complete Mechanical Turk API written in PHP that uses the same names as the official documentation","archived":false,"fork":false,"pushed_at":"2018-11-07T09:23:57.000Z","size":4,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-23T10:58:22.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrlcctrlv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-14T02:03:26.000Z","updated_at":"2022-10-04T20:06:51.000Z","dependencies_parsed_at":"2022-07-22T10:02:46.868Z","dependency_job_id":null,"html_url":"https://github.com/ctrlcctrlv/mturk-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ctrlcctrlv/mturk-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fmturk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fmturk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fmturk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fmturk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrlcctrlv","download_url":"https://codeload.github.com/ctrlcctrlv/mturk-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrlcctrlv%2Fmturk-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272452410,"owners_count":24937465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:24:00.771Z","updated_at":"2025-08-28T06:13:12.751Z","avatar_url":"https://github.com/ctrlcctrlv.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"mturk-php\n=========\n\nComplete Mechanical Turk API written in PHP that uses the same names as the official documentation\n\nmturk.php is a small library that sends requests to Mechanical Turk. It is much simpler than other libraries which redefine every function that Mechanical Turk recognizes. This saves you time so you don't have to worry about the library, just the Mechanical Turk API.\n\nmturk.php is written in the spirit of my original mTurk library, [mturk.py](https://github.com/ctrlcctrlv/mturk-python). Most names are kept the same between the two.\n\nRead the official mTurk API docs [here](http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html).\n\n**Example configuration file (mturkconfig.json)**\n```json\n{\n\"use_sandbox\" : false,\n\"verify_mturk_ssl\" : true,\n\"aws_key\" : \"ACCESSID\",\n\"aws_secret_key\" : \"PASSWORD\"\n}\n```\n**Getting your balance**\n```php\n$m = new MechanicalTurk();\n$r = $m-\u003erequest('GetAccountBalance');\nif (MechanicalTurk::is_valid($r))\n    echo 'Your balance is: ' . MechanicalTurk::get_response_element($r, 'Amount');\n```\n\n**Creating a HIT**\n```php\n\u003c?php\n$question = \u003c\u003c\u003cQUESTION\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cQuestionForm xmlns=\"http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd\"\u003e\n  \u003cQuestion\u003e\n    \u003cQuestionIdentifier\u003eanswer\u003c/QuestionIdentifier\u003e\n    \u003cQuestionContent\u003e\n      \u003cText\u003eHello world :^)\u003c/Text\u003e\n    \u003c/QuestionContent\u003e\n    \u003cAnswerSpecification\u003e\n      \u003cFreeTextAnswer/\u003e\n    \u003c/AnswerSpecification\u003e\n  \u003c/Question\u003e\n\u003c/QuestionForm\u003e\nQUESTION;\n\n$qual = array(\n    array('QualificationTypeId' =\u003e MechanicalTurk::N_APPROVED,\n          'Comparator' =\u003e 'GreaterThan',\n          'IntegerValue' =\u003e 18),\n    array('QualificationTypeId' =\u003e MechanicalTurk::P_APPROVED,\n          'Comparator' =\u003e 'GreaterThan',\n          'IntegerValue' =\u003e 75)\n);\n\n$reward = array(array('Amount' =\u003e 5, 'CurrencyCode' =\u003e 'USD'));\n\n$createhit = array(\"Title\" =\u003e \"Testing mturk-php API\",\n                   \"Description\" =\u003e \"https://github.com/ctrlcctrlv/mturk-php\",\n                   \"Keywords\" =\u003e \"testing, one, two, three\",\n                   \"Reward\" =\u003e $reward,\n                   \"Question\" =\u003e $question,\n                   \"QualificationRequirement\" =\u003e $qual,\n                   \"AssignmentDurationInSeconds\" =\u003e 90,\n                   \"LifetimeInSeconds\" =\u003e (60*60*24));\n\n$m = new MechanicalTurk();\n$r = $m-\u003erequest('CreateHIT', $createhit);\nvar_dump($r);\nvar_dump(MechanicalTurk::is_valid($r));\n?\u003e\n```\nIf you find any bugs please open a new issue. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fmturk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrlcctrlv%2Fmturk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrlcctrlv%2Fmturk-php/lists"}