Jump to content

redirect problem


sniperscope

Recommended Posts

Hi gurus.

I would like to ask that why this code takes a lot time to redirect to the index.php

i want to go to index.php right away i click the Submit button but test.php runs at background.

I am totally :confused: and  :'(

 

Great appreciate for any help

Regards

 

$ch 		= curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/admin/test.php");
curl_setopt($ch, CURLOPT_USERPWD, "user:pass");

$data		=  curl_exec($ch);

header("location: index.php?r=1");

Link to comment
https://forums.phpfreaks.com/topic/172801-redirect-problem/
Share on other sites

here is my exec command. But this command doesnt trigger test.php i put a small sql code which insert 1 line record and when i check db see nothing inserted.

 

exec ("/home/project/public_html/example/admin/_cron/test.php  >/dev/null &");

Link to comment
https://forums.phpfreaks.com/topic/172801-redirect-problem/#findComment-910800
Share on other sites

thorpe, i am very glad to your help. Really appreciate that.

 

last command you gave me didn't work. Well, redirecting ok but as i mention above. I have small sql script doesn't insert any record which means exec command not execute actually.

And another point

/usr/bin/php / is the same path for all linux servers ?

Link to comment
https://forums.phpfreaks.com/topic/172801-redirect-problem/#findComment-910823
Share on other sites

i am trying... Post data to (let's say) from form.php to insert.php. In insert.php(which has curl command previously i posted) going to test.php. Test.php is getting all records and put into a loop and send mail. But my problem is my hosting company allowed me to send 50 mails per 4 mins. So, when run loop i put a counter and if it reaches the 50 sleep(240); then get new smtp session send another 50 mails.

Here i found some solution but not sure if it works or not

1 - insert.php create a file and write number of last record of DB and redirect to index.php

2 - run a cron job every 5 min.

3 - open text file, read it and compare the number with db last record ie: write 50 in text file and db has 51 records. So which means not equal and run loop.

4 - before run loop write new value into text file to prevent run same script again

 

I will give a try to this way and hopefully works.

 

I really appreciate for your help

 

Regards

 

Note : if you have a better idea, ready to listen and try it.

Link to comment
https://forums.phpfreaks.com/topic/172801-redirect-problem/#findComment-910852
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.