$ open_email_msgを検索するスクリプトを取得して、さまざまな電子メールが異なる情報を持ちますが、以下のものと同じフォーマットを持つようにしたいと思います。strpos()の文字列にregexを使用する
正規表現はあまり使われていませんが、「タイトル:[データのタイトル]」、「カテゴリ:[カテゴリのデータ]」という文字列を検索すると、私は
strpos($open_email_msg, "Title: (*^)");
のようなものでもうまくいくとは思わないので。私が求めています。
をこれは、全体のコードだけ抜粋され、残りはMySQLのテーブルに情報を挿入してから掲載されますサイト上のニュース記事へ。
誰かが解決策を見つけるのを手助けできますか?これまでどうですか?
厳格な電子メールメッセージの形式:
ニュース更新
タイトル:記事タイトル
タグ:タグ1のTAG2
カテゴリー:記事のカテゴリ、第二条のカテゴリー
スニペット: 記事の抜粋。
メッセージ:記事メッセージ。画像。より多くのテキスト、 他のテキスト。 Lorem impsum dolle 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
?>