GithubHelp home page GithubHelp logo

php-mechanical-turk's People

Contributors

jackbot avatar scott113341 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

php-mechanical-turk's Issues

Example not working

I tried the example with my access keys, but there seem to be several errors. Some things I had to fix:
[1] You didn't urlencode the "question", which results in a bug if it includes whitespaces.
[2](and following) You forgot the brackets () around the ternary if-then-else operator. Therefore these fields are missing in the request..

Now at least the basic example works..

[1] https://github.com/jackbot/PHP-Mechanical-Turk/blob/master/MechanicalTurk.class.php#L59
[2] https://github.com/jackbot/PHP-Mechanical-Turk/blob/master/MechanicalTurk.class.php#L55

Now the createHit function looks like this:

`
public function createHit($question, $params = null) {

    $ts = $this->Unix2UTC(time());
    $url = $this->startUrl();
    $url .= '&Operation=CreateHIT';
    $url .= '&Signature=' . $this->generateSignature($this->MTURK_SERVICE, 'CreateHIT', $ts);
    $url .= '&Timestamp=' . $ts;
    $url .= '&Title=' . (isset($params['title']) ? urlencode($params['title']) : urlencode($this->defaults['title']));
    $url .= '&Description=' . (isset($params['description']) ? urlencode($params['description']) : urlencode($this->defaults['description']));
    $url .= '&Reward.1.Amount=' . (isset($params['reward']) ? urlencode($params['reward']) : $this->defaults['reward']);
    $url .= '&Reward.1.CurrencyCode=' . (isset($params['reward_currency']) ? urlencode($params['reward_currency']) : $this->defaults['reward_currency']);
    $url .= '&Question=' . (($question != null) ? urlencode($question) : urlencode($defaults['question']));
    $url .= '&AssignmentDurationInSeconds=' . $this->defaults['duration'];
    $url .= '&AutoApprovalDelayInSeconds=' . $this->defaults['auto_approve'];
    $url .= isset($params['qualification_requirement']) ? $this->generateQualificationRequirement($params['qualification_requirement']) : $this->generateQualificationRequirement($this->defaults['qualification_requirement']);
    $url .= '&LifetimeInSeconds=' . (isset($params['lifetime']) ? urlencode($params['lifetime']) : $this->defaults['lifetime']);
    $url .= '&Keywords=' . (isset($params['keywords']) ? urlencode(implode(', ', $params['keywords'])) : urlencode(implode(', ', $this->defaults['keywords'])));
    if (isset($params['requester_annotation'])) {
        $url .= '&RequesterAnnotation=' . $params['requester_annotation'];
    } else if (isset($defaults['requester_annotation'])) {
        $url .= '&RequesterAnnotation=' . $defaults['requester_annotation'];
    }

    $response = file_get_contents($url);
    return $response;
}

`

open source license?

Is it possible to specify the license this code is using? It'll help me decide whether to contribute to this codebase or start writing my own.

Either Apache or MIT license should be a good choice for potential business adopters. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.