execute some webpage without opening it?
Moderator: General Moderators
execute some webpage without opening it?
Hi all
How can I execute some webpage without opening it?
untill now I've used include("that_web_page"); bu I want to avoid this.
is it possible to do it with curl? I have checked for this on php.net - but could not wind answer
I'm on shared host.
Any suggestion is welcome.
Thank you all
regards ddragas
How can I execute some webpage without opening it?
untill now I've used include("that_web_page"); bu I want to avoid this.
is it possible to do it with curl? I have checked for this on php.net - but could not wind answer
I'm on shared host.
Any suggestion is welcome.
Thank you all
regards ddragas
-
deadoralive
- Forum Commoner
- Posts: 28
- Joined: Tue Nov 06, 2007 1:24 pm
If i understand you correctly curl will do what you want. have a look at http://www.php.net/curl for examples
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
web page with php script inside is on same server and under same domain. It should be executed in background.
This is for what I need it:
There is about 5000 recordsets that user inserts into one table, and here comes this script that should be executed in background. This script (from background) handle those recordsets, and if handled recordset is successfull, iz gets transfered to another table.
If I execute it with "include" user has to wait untill whole process finishes, and this could take a long time (depending from handle time).
What should I use then?
curl, exec ....
This is for what I need it:
There is about 5000 recordsets that user inserts into one table, and here comes this script that should be executed in background. This script (from background) handle those recordsets, and if handled recordset is successfull, iz gets transfered to another table.
If I execute it with "include" user has to wait untill whole process finishes, and this could take a long time (depending from handle time).
What should I use then?
curl, exec ....
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
cURL will wait for a response too (unless told otherwise.)
Look into using Snoopy to create a quick request to the page. http://snoopy.sf.net
Look into using Snoopy to create a quick request to the page. http://snoopy.sf.net
Re: execute some webpage without opening it?
Thank you for reply, but I was unable to acomplish starting php script in background. Can you please help me? Snoopy did not work as it should. Problem is that if php script is run by cron job or by browser php script works great - if it is run by snoopy or curl it does nothing
Can you please suggest me right solution?
Thank you ion advance
Kind regards ddragas
Can you please suggest me right solution?
Thank you ion advance
Kind regards ddragas
-
kennaasoft
- Forum Newbie
- Posts: 2
- Joined: Sun Jan 13, 2008 11:05 am
Re: execute some webpage without opening it?
hi ddraggas, have you tried considering the use of Ajax? I think that is the most reasonable way to run processes asynchronously; plus, you also get a notification when the process is completed.
- jimthunderbird
- Forum Contributor
- Posts: 147
- Joined: Tue Jul 04, 2006 3:59 am
- Location: San Francisco, CA
Re: execute some webpage without opening it?
I agree, I used to use this approach a lot if I'm sure the client's browser will turn on javascript and AJAX support.kennaasoft wrote:hi ddraggas, have you tried considering the use of Ajax? I think that is the most reasonable way to run processes asynchronously; plus, you also get a notification when the process is completed.
Re: execute some webpage without opening it?
Yes - you' re right.
Now I'm not big master of ajax, as this is my first contact with it
I've implemented it with ajax (prototype) but something is not working fine.
I'll try to describe problem.
First script (executable) is working ok, and after first script is done there is started second script - witch is not executed every time. I have noticed that when number of data posted from form to first script is big (10 000) - second script doesn't start, but if there is only submitted a few (<=20) then everything is working fine.
this is code that uses ajax.
There is nothing wrong with php scripts (tested)
If somebody can help me I would appreciate it
Now I'm not big master of ajax, as this is my first contact with it
I've implemented it with ajax (prototype) but something is not working fine.
I'll try to describe problem.
First script (executable) is working ok, and after first script is done there is started second script - witch is not executed every time. I have noticed that when number of data posted from form to first script is big (10 000) - second script doesn't start, but if there is only submitted a few (<=20) then everything is working fine.
Code: Select all
<script src="../prototype/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function init () {
$('Submit').onclick = function () {
sendData();
sendData1();
}
}
function sendData () {
var url = 'firstScript.php';
var pars = Form.serialize('myForm');
var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars, onLoading: showLoad, onComplete: showResponse} );
}
function sendData1 () {
var url = 'secondScript.php';
var pars = Form.serialize('myForm');
var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars} );
}
function showLoad () {
$('load').style.display = 'block';
}
function showResponse (originalRequest) {
var newData = originalRequest.responseText;
$('load').style.display = 'none';
$('status').innerHTML = newData;
}
</script>
There is nothing wrong with php scripts (tested)
If somebody can help me I would appreciate it