0

I'd like to be able to 'ping' a php page from my current php page, both on the same server. Once this happens, though, I don't want the 'ping' to hold up my script. Is this possible?

more detail: I want to send a request to another php page that will be used to log actions. So i'll pass different parameters in the url that another page will then read and process etc.

is there a better way to do this? the key is that I want to run the page and move on, regardless of whether or not the page i'm pinging actually works -- like it is running in parallel.

What i'm using now: file_get_contents("http://domain.com/track.php?type=error&code=4");

d-_-b
  • 21,536
  • 40
  • 150
  • 256
  • So you want asynchronous execution(?), then this might be of use to you: http://stackoverflow.com/questions/124462/asynchronous-php-calls – heikkim May 20 '13 at 06:03
  • What about `exec('php yourPage.php');` ? Will be run in parallel and you can pass whatever value you want to – RelevantUsername May 20 '13 at 06:03
  • If I understand correctly, you will want something asynchronous, like a jQuery AJAX call to your 2nd PHP script. – designosis May 20 '13 at 06:05
  • no, has to originate server side – d-_-b May 20 '13 at 06:05
  • @RelevantUsername sorry that doesnt seem to work. I'm using the same $url in that and `file_get_contents`, which works. – d-_-b May 20 '13 at 06:12
  • you can use ajax. php doesn't support threading if that's what you are asking for.. – Desolator May 20 '13 at 06:21
  • @RobinVanPersi are you implying user should install server-side javascript processor? – eis May 20 '13 at 06:22
  • 1
    @d-_-b by using the exec approach, you're supposed to use the server path to the script, not the url. – eis May 20 '13 at 06:23
  • thanks @eis, I can't seem to get that working either, i tried just the file name, and also copied what `pwd` says before it too. – d-_-b May 20 '13 at 06:29
  • @eis - no, its like he should run the first page just normally and use ajax to process the second page without interfering with the first page. simple, easy, dirty solution.. – Desolator May 20 '13 at 06:32
  • ajax is javascript. how can i do javascript in php? – d-_-b May 20 '13 at 06:33
  • Using threads? But i don't understand exactly want you want to achive with this. – Codebeat May 20 '13 at 06:55

0 Answers0