473,661 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sql php sms parse

1 New Member
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.c lass.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_dete ct);
>
> if($pop3->connect($serve r)){
> if($pop3->login($usernam e,$password)){
> if(!$msg_list = $pop3->get_office_sta tus()){
> 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<=$m sg_list["count_mail s"];$i++){
> if(!$header = $pop3->get_top($i)) {
> echo $pop3->error;
> }
> // Get Message ID and set $unique_id for save2file()
> $g = 0;
> while(!ereg("</HEADER>",$heade r[$g])){
> if(eregi("Messa ge-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($qu ery,$db["link"]) or die(mysql_error ());
>
> if($rows = mysql_fetch_arr ay($result)){
> $get_msg = FALSE;
> $savetofile = FALSE;
> $savetomysql = FALSE;
>
> }
> mysql_free_resu lt($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($fi lename)){
> if(!$filesize = $pop3->save2file($mes sage,$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($me ssage,$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_mail s"] == "0"){
> echo "Keine neuen Nachrichten !!";
> }
>
> mysql_close($db["link"]);
> $pop3->close();
>
> ?>
> _______________ _______________ __________
>> <?php
> require_once "ezc/Base/base.php";
> function __autoload( $className )
> {
> ezcBase::autolo ad( $className );
> }
> $pop3 = new ezcMailPop3Tran sport( "pop3.example.c om" );
> $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={$mai l->body->subType}\n--\n";
> echo $mail->body->text;
> echo "\n--\n";
> break;
> case 'ezcMailMultipa rtMixed':
> echo "Multipart mail\n";
> break;
> }
> echo "\n";
> }
> ?>
>
>> flash code:
>
>
> //Create the URLLOader instance
> var myLoader:URLLoa der = new URLLoader()
> //the data will come as URL-encoded variables
> myLoader.dataFo rmat = URLLoaderDataFo rmat.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(n ew URLRequest("ana stasio.aspx"))
> myLoader.load(n ew URLRequest("./scripts/text_10/jg_X_IDs.php"))
> //onLoad handler listener
> myLoader.addEve ntListener(Even t.COMPLETE, onDataLoad)
> //Error handling
> myLoader.addEve ntListener(IOEr rorEvent.IO_ERR OR, onIOError)
> myLoader.addEve ntListener(Secu rityErrorEvent. SECURITY_ERROR,
> onSecurityError )
> //Could be an error or just a message
> myLoader.addEve ntListener(HTTP StatusEvent.HTT P_STATUS, onHTTPStatus)
> //add a listener for the complete event
> function onDataLoad(evt: Event){
> for(var i:uint=0; i<evt.target.da ta.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.c lass.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 6177
ronverdonk
4,258 Recognized Expert Specialist
Urgent: please enclose any code within the proper code tags. See the Posting Guidelines on how to do that.

moderator
Feb 20 '08 #2

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

Similar topics

22
872
by: Ram Laxman | last post by:
Hi all, I have a text file which have data in CSV format. "empno","phonenumber","wardnumber" 12345,2234353,1000202 12326,2243653,1000098 Iam a beginner of C/C++ programming. I don't know how to tokenize the comma separated values.I used strtok function reading line by line using fgets.but it gives some weird behavior.It doesnot stripout the "" fully.Could any body have sample code for the same so that it will be helfful for my...
24
3158
by: | last post by:
Hi, I need to read a big CSV file, where different fields should be converted to different types, such as int, double, datetime, SqlMoney, etc. I have an array, which describes the fields and their types. I would like to somehow store a reference to parsing operations in this array (such as Int32.Parse, Double.Parse, SqlMoney.Parse, etc), so I can invoke the appropriate one without writing a long switch.
3
35080
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
3
24390
by: Mark | last post by:
How do you parse a currency string to a decimal? I'd like to avoid having to parse the number out, removing the $ manually. That sounds like a hack. There are times that this string will be currency and others when it will be a text integer or decimal. //This bombs because of the string having an improper format. Decimal.Parse("$9,200.00") Thanks in advance! Mark
14
3666
by: Jon Davis | last post by:
I have put my users through so much crap with this bug it is an absolute shame. I have a product that reads/writes RSS 2.0 documents, among other things. The RSS 2.0 spec mandates an en-US style of date formatting (RFC 822). I have been using a variation of RFC 1123 (just change the time zone to an offset, i.e. "-0800"). It seems to be writing okay, but it's failing to parse. I've tried changing the regional & language settings in my...
3
3242
by: Bob Rundle | last post by:
I would like to get something like this to work... Type t = FindMyType(); // might be int, float, double, etc string s = "1233"; object v = t.Parse(s); This doesn't work of couse, Parse is not a member of Type. I have to think that this is possible. Is it?
3
3078
by: Slonocode | last post by:
I have some textboxes bound to an access db. I wanted to format the textboxes that displayed currency and date info so I did the following: Dim WithEvents oBidAmt As Binding oBidAmt = New Binding("Text", Me.Ds1, "Items.BidAmt") txtBidAmt.DataBindings.Add(oBidAmt) Private Sub oBidAmt_Format(ByVal sender As Object, ByVal e As System.Windows.Forms.ConvertEventArgs) Handles oBidAmt.Format
5
5134
by: js | last post by:
I have a textbox contains text in the format of "yyyy/MM/dd hh:mm:ss". I need to parse the text using System.DateTime.Parse() function with custom format. I got an error using the following code. Could someone help me with the customization? Thanks. String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at System.DateTime.Parse(String s, IFormatProvider...
2
3491
by: Samuel R. Neff | last post by:
I'm using a quasi open-source project and am running into an exception in double.Parse which is effectively this: double.Parse(double.MinValue.ToString()) System.OverflowException: Value was either too large or too small for a Double. at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info)
3
21260
by: Peter Duniho | last post by:
I'm sure there's a good explanation for this, but I can't figure it out. I tried using DateTime.Parse() with a custom DateTimeFormatInfo instance, in which I'd replaced the DateTimeFormatInfo.FullDateTimePattern property with my custom format string: DateTimeFormatInfo dtfi = (DateTimeFormatInfo)DateTimeFormatInfo.InvariantCulture.Clone(); dtfi.FullDateTimePattern = "dd/MMM/yyyy:HH:mm:ss zzz";
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.