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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeffeyp
Forum Newbie
Posts: 5
Joined: Thu Mar 27, 2008 4:23 pm

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

Post 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";
}
}
?>
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

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

Post by Zoxive »

Your most likely looking for Curl, Plenty of articles. Even here.
jeffeyp
Forum Newbie
Posts: 5
Joined: Thu Mar 27, 2008 4:23 pm

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

Post 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);
Post Reply