Im very new to api stuff and want to do following: Post a new card to a trello board using a form on my page. Trello offers a api, but I dont not really know how to use it: http://mattzuba.bitbucket.org/php-trello/
My form looks like this:
<form id="trello" class="form-horizontal">
<div class="form-group">
<div class="col-md-6">
<input type="text" name="Name" placeholder="Name" class="form-control" />
</div>
<div class="col-md-6">
<input type="email" name="email" placeholder="eMail" class="form-control" />
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input type="text" name="Title" placeholder="Title" class="form-control" />
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<textarea name="content" cols="40" rows="10" placeholder="Content" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input type="file" name="attachment" value="1" class="form-control">
</div>
</div>
<div class="form-group">
<a class="btn btn-primary" id="submit">Submit</a>
</div>
</form>
Now I want to create a card that looks like this:
card-name: $title
card-content: $content
Submitted by: $name ($email)
card-attachment: $attachment
Because this form should be public (with captcha), the oAuth is no way for me :/
I dont know how to archive this :/ If somebody gives me an example, this would be awesome :)
Can somebody help me?
Trello has to know what user is performing actions on any cards or boards. If you don't want to force your users to login, or use the Oauth, what you can do is create a token attached to a generic Trello user (create a separate user, they're free!) then use that user to create the actual card from your PHP form.
TO do this, you will need to login to Trello as whatever user you want creating the cards, then follow the process for creating a token as laid out at the link below. Since you are creating cards, you will need to make sure you request a token that has write access.
https://trello.com/docs/gettingstarted/index.html#getting-a-token-from-a-user
Once you get the token back from that process, you can use that token when you create the Trello object in your PHP script.
$trello = new Trello($key, null, $token);
$me = $trello->post('cards', $params);
$key and $token will be generated from the link mentioned above.