Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron with PHP...

Status
Not open for further replies.

youradds

Programmer
Joined
Jun 27, 2001
Messages
817
Location
GB
Does anyone know what something like this would mean;

Your Terminal type is unknown!

Enter a terminal type: [vt100]
TERMINAL TYPE IS SET TO vt100
(B)0[?7h[?1h=Getting [mLooking up greetings.mysearchengine.com



[?1l>

Running the 'lynx' command via SSH, or calling the URL in a browser works fine. So why whats all this Terminal thing about, and all that garbage charachters? FYI, I didn't include the real URL in the error message....for obvious reasons :)

Cheers

Andy
 
The garbage characters are text formatting commands -- boldface, different colors.

For apps that run on the console on unix-like OSes, the terminal type is set in the resource files that are accessed on login.


Want the best answers? Ask the best questions: TANSTAAFL!
 
But does that mean the script is running, or not? I added a 'mail' call within the script, and althought I got the cron 'error' email, I didn't get the running confirmation email. This leads me to think that it is not running :|

Cheers

Andy
 
All it should do is print out the current date (in format of 2003-10-10). The script is;

Code:
<?php

// grab the config file...
 require(&quot;config.php&quot;);

// grab todays date..
 $daten = date('Y-m-d');

// print the date for verification, and also so we don't get no output...
 echo $daten;

   // run the query so we grab the data for anyone who wants to send today...
	$result= @mysql_query(&quot;SELECT * from sent where datetosend = '$daten' &quot;);
	//Execute the query
	if (!$result) { 
          $error = mysql_error();
          echo &quot;error displaying. Reason: $error&quot;; 
    } 

    // start the 'while' to actually do the sending out...
     while ( $row = mysql_fetch_array($result) ) {
     	$randomid=$row['randomid'];
		$fromname=$row['fromname'];
		$toemail=$row['toemail'];
		$fromemail=$row['fromemail'];
		
        echo &quot;Sending to: $toemail (from $fromname) <BR>&quot;;

$messagebody='Hi' . $fromname . ' has sent you a greeting card.
To collect it simply visit[URL unfurl="true"]www.bn23.com/greetings/view.php?randomid='[/URL] . $randomid . '
Alternatively visit [URL unfurl="true"]www.bn23.com/greetings/view.php[/URL] and enter the ID ' . $randomid . '
If you do not know the person who sent this email please ignore it.
bn23.com';

   mail($toemail,'You have been sent a greeting card!',$messagebody,'FROM: greetings@site.com');

   $result2 = @mysql_query(&quot;UPDATE sent SET isSent = 1 WHERE randomid = $randomid&quot;);
   $error = mysql_error();
   if ($error) { echo &quot;Error running SQL. Reason: $error <BR>&quot;; } 
   
}

   mail('programmer@ace-installer.com','E-card cron run...',&quot;The cron for greetings.site.com has been run. Date run was: $daten&quot;, 'FROM: greetings@site.com');
exit();

?>

Cheers

Andy
 
>>>Do you have a command-line PHP interpreter available? <<<

What do you mean? Something like /usr/bin/php or something?

Cheers

Andy
 
Thanks. I'll get in contact with my host, and ask them if they support this feature.

Cheers

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top