Jump to content

php file problem


srinivas6203

Recommended Posts

hi all

 

I want to print email from file. the file contains like this.

 

time=""

register=no

mailserver=mail.google.com

email=nani@gmail.com

password=xxxxxxxxxxxxxxxx

status="online"

 

From this i want to get email and print it on to the browser. i con't use line wise print. because that file will change the order every time , That means , now email row was in 4th line. after refresh the browser that email row might be go into the 2nd or last line etc. So first i want find word "email=" and then retrieve correspondent email "nani@gmail.com" and print that email. like wise remaining fields.

 

can any one send me script or url's.

 

please its urgent.

 

thanq

Link to comment
Share on other sites

Try this, replacing $str with the contents of the file that you select.

 

$str = 'time=""
register=no
mailserver=mail.google.com
email=nani@gmail.com
password=xxxxxxxxxxxxxxxx
status="online"';

preg_match("#email=([a-zA-Z0-9\-_\.]+\@[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})#i",$str,$matches);
$email = $matches[1];

echo $email;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.