Chcę uzyskać skrypty do wyszukiwania $ open_email_msg, które różne e-maile będą miały inne informacje, ale w tym samym formacie, co poniżej.Używanie wyrażenia regularnego w ciągu znaków dla strpos()
Tak naprawdę nie używałem dużo regexa, ale chcę to zrobić za każdym razem, gdy szukam łańcucha, który będzie wyszukiwał "Tytuł: [dane tytułu]", "Kategorie: [dane dla kategorii] . pytam, bo nie sądzę, żeby coś takiego
strpos($open_email_msg, "Title: (*^)");
będzie jeszcze pracować.
jest to tylko fragment całego kodu, reszta wstawia informacje do tabeli MySQL, a następnie jest wysyłany do artykułu z wiadomościami na stronie:
Czy ktoś może mi pomóc znaleźć rozwiązanie do tego proszę?
Strict e-mail format wiadomości:
Aktualności Aktualizacja
Tytuł: Tytuł artykułu
Tagi: tag1 tag2
Kategorie: Artykuł kategoria, 2. Artykuł Kategoria
Snippet: Artykuł fragment.
Wiadomość: Wiadomość z artykułem. Obrazy. Więcej tekstu, więcej tekstu. 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
?>