$open_email_msg を検索するスクリプトを取得したいのですが、電子メールによって情報は異なりますが、以下のように同じ形式になります。
私は正規表現をあまり使用していませんが、私がやりたいのは、「タイトル:[タイトルのデータ]」、「カテゴリ:[カテゴリのデータ]」を検索する文字列を検索することです。みたいなことは考えないから
strpos($open_email_msg, "Title: (*^)");
うまくいくでしょう。
これはコード全体のスニペットにすぎません。残りは情報を MySQL テーブルに挿入し、サイトのニュース記事に投稿します。
誰かがこれに対する解決策を見つけるのを手伝ってくれますか?
厳密な電子メール メッセージ形式:
ニュース更新の
タイトル: 記事のタイトル
タグ: tag1 tag2
カテゴリ: 記事のカテゴリ、2 番目の記事のカテゴリ
スニペット: 記事のスニペット。
メッセージ: 記事のメッセージ。画像。より多くのテキスト、より多くのテキスト。Lorem impsum dolor sit amet.
<?php
//These functions searches the open e-mail for the the prefix defining strings.
//Need a function to search after the space after the strings because the subject, categories, snippet, tags and message are constant-changing.
$subject = strpos($open_email_msg, "Title:"); //Searches the open e-mail for the string "Title"
$subject = str_replace("Title: ", "" ,$subject);
$categories = strpos($open_email_msg, "Categories:"); //Searches the open e-mail for the string "Categories"
$snippet = strpos($open_email_msg,"Snippet"); //Searches the open e-mail for the string "Snippet"
$content = strpos($open_email_msg, "Message"); //Searches the open-email for the string "Message"
$tags = str_replace(' ',',',$subject); //DDIE
$uri = str_replace(' ','-',$subject); //DDIE
$when = strtotime("now"); //date article was posted
?>