Page 1 of 1

Sending a request (post or get) without leaving the page

Posted: Thu Jun 26, 2008 6:08 pm
by jeffeyp
I am querying a MySQL database for events that need to be run on another server. When an event time comes up I need to send a request (either post or get) to the other server to start that event. There may be more than one event to be started at the same time. I need to check for events to be run up to 15 minutes prior to the event time.

Here is what I have so far:
<?php
// Check for events to be run
$strSQL = "SELECT * from tblque WHERE EventDate = CURDATE() AND EventRun = '0' AND (EventTime >= CURTIME() AND EventTime <= ADDTIME(CURTIME(), '15:00'))";
// echo $strSQL;
$resultr = mysql_query($strSQL);
while ($rowRun = mysql_fetch_array($resultr)) {

if (mysql_num_rows($resultr) > 0) {
echo "RUN EVENT"; // This is where the HTTP request goes so the query can loop through the results

// echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://test.php?action=edit&EventID=" . $rowRun['EventID'] . "\">";

}
else {
echo "NO EVENTS";
}
}
?>

Re: Sending a request (post or get) without leaving the page

Posted: Thu Jun 26, 2008 9:39 pm
by Zoxive
Your most likely looking for Curl, Plenty of articles. Even here.

Re: Sending a request (post or get) without leaving the page

Posted: Fri Jun 27, 2008 5:10 pm
by jeffeyp
Cool!!! Thanks Zoxive.

http://www.askapache.com/htaccess/sendi ... -curl.html

$ch = curl_init('http://www.mysite.com/index.php?option= ... &Itemid=55');
curl_exec ($ch);
curl_close ($ch);