
最終目的はWebhooksで
URL:省略 (仮にhttp://xxx.ne.jp/location.phpとする。)
Method:POST
Contents:Type application/json
↓ここが間違っている?
Body: {"key": {{OccurredAt}},"key2":"2","key3":"3"}
※key2、key3は場所ごとに変更予定
if this then thatの thisをlocation(you enter an area) thatを webhooksとしました。
- location.php ここが間違っている?
PHP
1<?php 2header("Content-type: text/html; charset=utf-8"); 3 4$title = "json結果"; 5 6$key1 = $_POST['key']; 7$key2 = $_POST['key2']; 8$key3 = $_POST['key3']; 9 10$body = "実行日時:".date('Y/m/d H:i:s')."\r\n"; 11 12$body = $body."result\r\n".$key1."\r\n".$key2."\r\n".$key3."\r\n"; 13 14$from = "dummy-dummy-xyz-abc@example.com"; 15$headers = 'From: '.mb_encode_mimeheader("test").'<'.$from.'>'; 16$headers .= "Return-Path: dummy-dummy-xyz-abc@example.com"; 17 18mb_language('Japanese'); 19mb_internal_encoding("UTF-8"); 20 21// 本来はsendtodropbox 22if (mb_send_mail("dummy-dummy-xyz-drop@example.com", $title, $body , $headers)) { 23 echo date('Y/m/d H:i:s')."に送信完了"; 24} else { 25 echo date('Y/m/d H:i:s')."に送信失敗"; 26}
これで仮仕様として事前に設定した位置に入った時にsendtodropboxにて自分のdropboxにテキストを書き込ませるようにしたのですが、動いたには動いたのですが
- body.txt
実行日時:2019/08/17 13:16:33 result
resultの後は空白+改行となります。
IFTTTのlocationで作成したphpに値を渡す正しいソースコードをご教授願います。




回答1件
あなたの回答
tips
プレビュー