retrieve variables in a txt of multiple values in php
up vote
0
down vote
favorite
content in txt file:
<test@test.com>: connect to test.com[00.00.00.0]:0: Connection timed out
recipient=test@test.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test.com[00.00.00.0]:0: Connection timed out
<test234@test234.com>: connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I need to get in variables in the txt file:
for example:
$email = test234@test234.com
$content = : connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I try but not working
<?php
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
preg_match_all('/<(.+)>/', $line, $coincidencias);
foreach ($coincidencias[1] AS $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."',' $description (the description)',now());";
echo '<pre>'.$sql. '</pre>';
mysql_query($sql);
}
}
I can not find the right way how to do it
I need to get them in variables for storage in databases.
php text text-files
add a comment |
up vote
0
down vote
favorite
content in txt file:
<test@test.com>: connect to test.com[00.00.00.0]:0: Connection timed out
recipient=test@test.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test.com[00.00.00.0]:0: Connection timed out
<test234@test234.com>: connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I need to get in variables in the txt file:
for example:
$email = test234@test234.com
$content = : connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I try but not working
<?php
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
preg_match_all('/<(.+)>/', $line, $coincidencias);
foreach ($coincidencias[1] AS $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."',' $description (the description)',now());";
echo '<pre>'.$sql. '</pre>';
mysql_query($sql);
}
}
I can not find the right way how to do it
I need to get them in variables for storage in databases.
php text text-files
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
content in txt file:
<test@test.com>: connect to test.com[00.00.00.0]:0: Connection timed out
recipient=test@test.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test.com[00.00.00.0]:0: Connection timed out
<test234@test234.com>: connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I need to get in variables in the txt file:
for example:
$email = test234@test234.com
$content = : connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I try but not working
<?php
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
preg_match_all('/<(.+)>/', $line, $coincidencias);
foreach ($coincidencias[1] AS $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."',' $description (the description)',now());";
echo '<pre>'.$sql. '</pre>';
mysql_query($sql);
}
}
I can not find the right way how to do it
I need to get them in variables for storage in databases.
php text text-files
content in txt file:
<test@test.com>: connect to test.com[00.00.00.0]:0: Connection timed out
recipient=test@test.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test.com[00.00.00.0]:0: Connection timed out
<test234@test234.com>: connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I need to get in variables in the txt file:
for example:
$email = test234@test234.com
$content = : connect to e-mail.com[00.00.00.0]:0: Connection timed out
recipient=test234@test234.com
offset=00000
status=0.0.0
action=delayed
reason=connect to test234.com[00.00.00.0]:0: Connection timed out
I try but not working
<?php
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
preg_match_all('/<(.+)>/', $line, $coincidencias);
foreach ($coincidencias[1] AS $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."',' $description (the description)',now());";
echo '<pre>'.$sql. '</pre>';
mysql_query($sql);
}
}
I can not find the right way how to do it
I need to get them in variables for storage in databases.
php text text-files
php text text-files
edited Nov 11 at 6:38
Cœur
17k9102140
17k9102140
asked Jan 29 '13 at 14:36
Eduardo
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
$i = 0;
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
if (preg_match('/<(.+)>/', $line, $email)) {
$coincidencias = $email[1];
}
if (strlen(trim($line)) > 0) {
$still_empty = false;
$content[$i] .= preg_replace('/<.+>: /', '', $line);
} else {
if (!$still_empty) {
$i++;
}
$still_empty = true;
}
}
$i = 0;
foreach ($coincidencias as $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."','".$content[$i]."',now());";
echo '<pre>'.$sql.'</pre>';
$i++;
mysql_query($sql);
}
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
$i = 0;
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
if (preg_match('/<(.+)>/', $line, $email)) {
$coincidencias = $email[1];
}
if (strlen(trim($line)) > 0) {
$still_empty = false;
$content[$i] .= preg_replace('/<.+>: /', '', $line);
} else {
if (!$still_empty) {
$i++;
}
$still_empty = true;
}
}
$i = 0;
foreach ($coincidencias as $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."','".$content[$i]."',now());";
echo '<pre>'.$sql.'</pre>';
$i++;
mysql_query($sql);
}
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
add a comment |
up vote
0
down vote
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
$i = 0;
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
if (preg_match('/<(.+)>/', $line, $email)) {
$coincidencias = $email[1];
}
if (strlen(trim($line)) > 0) {
$still_empty = false;
$content[$i] .= preg_replace('/<.+>: /', '', $line);
} else {
if (!$still_empty) {
$i++;
}
$still_empty = true;
}
}
$i = 0;
foreach ($coincidencias as $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."','".$content[$i]."',now());";
echo '<pre>'.$sql.'</pre>';
$i++;
mysql_query($sql);
}
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
add a comment |
up vote
0
down vote
up vote
0
down vote
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
$i = 0;
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
if (preg_match('/<(.+)>/', $line, $email)) {
$coincidencias = $email[1];
}
if (strlen(trim($line)) > 0) {
$still_empty = false;
$content[$i] .= preg_replace('/<.+>: /', '', $line);
} else {
if (!$still_empty) {
$i++;
}
$still_empty = true;
}
}
$i = 0;
foreach ($coincidencias as $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."','".$content[$i]."',now());";
echo '<pre>'.$sql.'</pre>';
$i++;
mysql_query($sql);
}
$connect = mysql_connect('localhost','root','');
if(!$connect)
{
die('Could not connect:' . mysql_error());
}
mysql_select_db('test',$connect);
// txt file
$file = fopen("email_errors.txt", "r") or exit ("Unable to open file");
$i = 0;
while ( ($line = fgets($file)) !== false) {
// get the email <email@email.com>
if (preg_match('/<(.+)>/', $line, $email)) {
$coincidencias = $email[1];
}
if (strlen(trim($line)) > 0) {
$still_empty = false;
$content[$i] .= preg_replace('/<.+>: /', '', $line);
} else {
if (!$still_empty) {
$i++;
}
$still_empty = true;
}
}
$i = 0;
foreach ($coincidencias as $email)
{
// create a query and insert into database
$sql = "INSERT INTO errormailer(id_error, email, description, fecha) VALUES(NULL,'".$email."','".$content[$i]."',now());";
echo '<pre>'.$sql.'</pre>';
$i++;
mysql_query($sql);
}
edited Jan 29 '13 at 16:18
answered Jan 29 '13 at 16:12
Antony
13k103667
13k103667
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
add a comment |
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
Thanks for your help, and do not know what to do. php display notice,Notice: Undefined offset: 0 in upload.php on line 29. I'm checking
– Eduardo
Jan 29 '13 at 16:31
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
@Eduardo What do you mean by do not know what to do? What kind of help do you need?
– Antony
Jan 29 '13 at 16:32
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14585379%2fretrieve-variables-in-a-txt-of-multiple-values-in-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown