Skip to content

Instantly share code, notes, and snippets.

@tim-peterson
Last active December 11, 2015 23:08
Show Gist options
  • Save tim-peterson/4674287 to your computer and use it in GitHub Desktop.
Save tim-peterson/4674287 to your computer and use it in GitHub Desktop.
Dwolla json_decode $_POST
$file = 'application/views/dwolla/post.php';
// Open the file to get existing content
$current = file_get_contents($file);
$date=date("Y-m-d H:i:s");
$post=json_decode(file_get_contents('php://input'), TRUE);
if($post){
// Append a new person to the file
foreach($post as $key=>$value) {
$current .= "$key: $value\n";
}
}
else{
$current .= 'post_$_GET';
$data['title']='post';
$this->view('dwolla/post', $data, 'post', false);
}
$current .= $date."\n";
$current .= "\n";
// Write the contents back to the file
file_put_contents($file, $current);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment