472,125 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

sql php sms parse

hi all, please exuse my email ">" i am working on location.

> hey team, thanks for the quick reply.
>
> i am trying to parse a pop3 account and populate it into flash.
>
> the how to code...
> http://www.derickrethans.nl/parsing_mail_with_php.php
>
> - is this the class? i am really confused how to plug this into my
> hosting account. i am already using php and sql to dynamically update
> flash.
>
> here is what should be the only 2 php scripts i need, from what i "assume"
> one is a class property, and the second calls it up and defines it? i
> just don't know how to plug it in???
[php]
> <?php
> /*
> Sample File not more !!!
> Author: Jointy <bestmischmaker@web.de>
>
> Please read Readme.txt !!!
> */
>
> require("pop3.class.inc");
>
> // Constructor
> // optional
> $apop_detect = TRUE; // default = FALSE
> $log = TRUE; // default = FALSE
> $log_file = "pop3.class.log"; // must be set when $log = TRUE !!!
> $qmailer = FALSE;
>
>
> // func $pop3->connect()
> $server = "pop.lycos.de";
> // optional !!
> // $port = "110";
> // $conn_timeout = "25"; // Connection Timeout
> // $sock_timeout = "10,500"; // Socket Timeout
>
> // func $pop3->login()
> $username = "";
> $password = "";
> // optional
> //$apop = "0";
>
> // MySQL Vars for connect to DB Server
> $db["addr"] = "localhost";
> $db["user"] = "";
> $db["pass"] = "";
> $db["link"] = FALSE;
> $db["use"] = "mail";
> // optional
> $db["dir_table"] = "inbox"; // Table for header data
> $db["msg_table"] = "messages"; // Table for complete Messages (/w
> header)...
>
>
> // Your own free Vars
> // Save to MySQL ??
> $savetomysql = TRUE;
> $savetofile = TRUE;
> $delete = FALSE;
>
>
>
>
>
>
> $pop3 = new POP3($log,$log_file,$apop_detect);
>
> if($pop3->connect($server)){
> if($pop3->login($username,$password)){
> if(!$msg_list = $pop3->get_office_status()){
> echo $pop3->error;
> return;
> }
> }else{
> echo $pop3->error;
> return;
> }
> }else{
> echo $pop3->error;
> return;
> }
>
> $db["link"] = mysql_connect($db["addr"],$db["user"],$db["pass"]) or
> die(mysql_error());
> mysql_select_db($db["use"],$db["link"]) or die(mysql_error());
>
> $noob = TRUE;
>
> for($i=1;$i<=$msg_list["count_mails"];$i++){
> if(!$header = $pop3->get_top($i)){
> echo $pop3->error;
> }
> // Get Message ID and set $unique_id for save2file()
> $g = 0;
> while(!ereg("</HEADER>",$header[$g])){
> if(eregi("Message-ID",$header[$g])){
> $unique_id = md5($header[$g]);
> }
> $g++;
> }
> unset($g);
>
> $query = 'SELECT `unique_id` FROM `'.$msg_table.'` WHERE 1 AND
> `unique_id` = \''.$unique_id.'\' LIMIT 0, 1';
> $result = mysql_query($query,$db["link"]) or die(mysql_error());
>
> if($rows = mysql_fetch_array($result)){
> $get_msg = FALSE;
> $savetofile = FALSE;
> $savetomysql = FALSE;
>
> }
> mysql_free_result($result);
> unset($rows);
>
> if($get_msg){
> if(!$message = $pop3->get_mail($i, $qmailer)){
> echo $pop3->error;
> $savetofile = FALSE;
> $savetomysql = FALSE;
> $delete = FALSE;
> }
> }
>> if($savetofile){
>
>
>
> $filename = ".//mails//".$unique_id.".txt";
>
> if(!is_file($filename)){
> if(!$filesize = $pop3->save2file($message,$filename)){
> echo $pop3->error;
> return;
> }else{
> echo "File saved to ".$filename." (".$filesize." Bytes written)
> !! \r\n <br>";
> }
> }else{
> echo "File <b>(".$filename.")</b> already exists. !! \r\n
> <br>";
> }
> }
>
> // Save to MySQL
> if($savetomysql){
>
> if($count_bytes =
> $pop3->save2mysql($message,$db["link"],$db["dir_table"],$db["msg_table"])){
> echo "File save to MySQL complete. (".$count_bytes." Bytes
> written) !! \r\n <br>";
> }else{
> echo $pop3->error;
> return;
> }
> }
>
> // Send Noob command !!
> if($noop){
> if(!$pop3->noop()){
> echo $pop3->error;
> $noob = FALSE;
> }
> }
>
> // Delete MSG
> if($delete){
> if($pop3->delete_mail($i)){
> echo "Nachricht als gelöscht markiert !!! \r\n <br>";
> }else{
> echo $pop3->error;
> }
> }
>
> }
> if($msg_list["count_mails"] == "0"){
> echo "Keine neuen Nachrichten !!";
> }
>
> mysql_close($db["link"]);
> $pop3->close();
>
> ?>
> ________________________________________
>> <?php
> require_once "ezc/Base/base.php";
> function __autoload( $className )
> {
> ezcBase::autoload( $className );
> }
> $pop3 = new ezcMailPop3Transport( "pop3.example.com" );
> $pop3->authenticate( "user", "password" );
> $set = $pop3->fetchAll();
> $parser = new ezcMailParser();
> $mails = $parser->parseMail( $set );
> foreach ( $mails as $mail )
> {
> echo "From: {$mail->from->email}\n";
> echo "To: ";
> foreach ( $mail->to as $to ) {
> echo "{$to->name} ({$to->email}) ";
> }
> echo "\n";
> echo "Subject: {$mail->subject}\n";
> switch ( get_class( $mail->body ) )
> {
> case 'ezcMailText':
> echo "Text part, ".
> "type={$mail->body->subType}\n--\n";
> echo $mail->body->text;
> echo "\n--\n";
> break;
> case 'ezcMailMultipartMixed':
> echo "Multipart mail\n";
> break;
> }
> echo "\n";
> }
> ?>
>
>> flash code:
>
>
> //Create the URLLOader instance
> var myLoader:URLLoader = new URLLoader()
> //the data will come as URL-encoded variables
> myLoader.dataFormat = URLLoaderDataFormat.VARIABLES
> //Load using an URLRequest. If you use some other back-end
> //language like java or aspx, you just modify the call, i.e
> // myLoader.load(new URLRequest("anastasio.aspx"))
> myLoader.load(new URLRequest("./scripts/text_10/jg_X_IDs.php"))
> //onLoad handler listener
> myLoader.addEventListener(Event.COMPLETE, onDataLoad)
> //Error handling
> myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
> myLoader.addEventListener(SecurityErrorEvent.SECUR ITY_ERROR,
> onSecurityError)
> //Could be an error or just a message
> myLoader.addEventListener(HTTPStatusEvent.HTTP_STA TUS, onHTTPStatus)
> //add a listener for the complete event
> function onDataLoad(evt:Event){
> for(var i:uint=0; i<evt.target.data.cant; i++){
> this["Title_0"+i]Text = evt.target.data["Title"+i]}
>
>
> //populates it into dynamic text boxes. with instance names.
>[/php]
> ________________________________________
>>
> questions:
> Mail component php? - how do i use this and interact with flash?
>
> a simple explination of ez Components would be a great help too...can i
> plug this stuff into godaddy and reference it the same way i use classes
> in flash? only with this code php...
>
> require("pop3.class.inc");
> - http://ezcomponents.org/docs/api/1.0...tion_Mail.html
>
>
> i would be happy at this point to just get the php to hold my data and
> have flash pull it and post the whole raw sms code onto the stage.
>
> or do i have to install it, and use pearl, or pear in some way - i hope
> not? because i have no idea what that means.
>
> i have two php files. that should be able to pull this off, however i
> don't understand classes with php and if it can work on my linux shared
> hosting account or if i need to setup a different account with another
> hosting company. it should work because it doesn't require root access
> for this.
>
> or if i need to setup a gsm modem, and a whole sms gateway server, blah,
> blah. I think we can just do this with php parsing a pop3 and flash
> pulling those values. eventually transfering to a sql database is ideal,
> but probably out of your teams scope of help.
>> basically i am trying to read email from flash. any free pop3 account
> would work, or if you prefer i am hosted with godaddy.
>
> more definitive: recieve an sms message, and transfer the body, date, time
> to a sql server. I know this is php, but i already have most of the
> research done. please help! and bottom line i am looking to pull into
> flash. i hope you can help.
>
> i believe i have all of the language i need, now just the question of how
> to make it work.
Feb 20 '08 #1
1 6077
ronverdonk
4,258 Expert 4TB
Urgent: please enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

moderator
Feb 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

22 posts views Thread by Ram Laxman | last post: by
3 posts views Thread by Jon Davis | last post: by
3 posts views Thread by Mark | last post: by
3 posts views Thread by Bob Rundle | last post: by
5 posts views Thread by js | last post: by
3 posts views Thread by Peter Duniho | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.