mailing in PHP using mail function..

January 5, 2008

First the syntax of the mail function is ..

mail($to$subject$message$headers);

$to-> to mail ID

$subject->the sub of the mail.

$message->the actual text message to send to the $to.

$headers->can contain the info regarding from or purpose..

and finally define the variables ..

$to=’kumargandhi30@gmail.com’;

$subject=’How are U my Friend?’;

$message=’hi kumar’;

$headers=’From:me@gmail.com’;

and now call the function.. mail($to$subject$message$headers);

this will send a mail to the mentioned..


Read data from PHP into Flex app..

January 5, 2008

First the data in PHP looks like this–

echo “<CALCU>”;

echo “<CALCUS>”;
echo “<ID>”1232″</ID>”;
echo “<AMTSPE>”12365″</AMTSPE>”;
echo “<DATE>”2007/11/11″</DATE>”;
echo “<DESCRY>”hai”</DESCRY>”;
echo “</CALCUS>”; .

echo “</CALCU>”;

Now to get this data into Flex app we got to use HttpService(there are other services) and a property result in it..

<mx:HTTPService id=”srvMain” useProxy=”false” showBusyCursor=”true”
fault=”httperror()” result=”readmeMain(event);”/>

now the result will be fetched into event so to get it define the method as mentioned in the result property of the httpService.. as below..

private function readmeMain(event:ResultEvent):void
{
var amountspe:String=new String;

amountspe=event.result.CALCU.CALCUS.AMTSPE;

}

Now the string amountspe contains the valuse sent by the PHP page(particular as given in colors).

Similarly get other values into strings or inputs..


Sending data from PHP as XML.

January 5, 2008

The basic XML data looks like –

<product>

<pname>mouse</product>

<cost>100</cost>

</product>

so this in PHP pages looks like–

echo “<product>”;

echo “<pname>”mouse”</pname>”;

echo “<cost>”100″</cost>”;

echo “</product>”;

here iam using echo statement of PHP to represent data as XML and this page is called in an HTTPSERVICE.