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 protected]

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 "[email protected]" and print that email. like wise remaining fields.

 

can any one send me script or url's.

 

please its urgent.

 

thanq

Link to comment
https://forums.phpfreaks.com/topic/117298-php-file-problem/
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 protected]
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
https://forums.phpfreaks.com/topic/117298-php-file-problem/#findComment-603563
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.