Zielegerd
Berichten: 89
avatar
Offline Stuur privebericht
Beste Criminals Point leden,

Ik heb hulp nodig, ik moet een Cronjob maken maar deze host die ik nu heb heeft het niet.
Dus ik vroeg me af of het mogelijk is om het in een config.php script te doen?, zo ja, welke Coding/line heb ik nodig om het te tedoen.

Welke script?
Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php

include "config.php";

if(
$username != '' && $password != '')
{

    
$sql mysql_query("SELECT * FROM messages WHERE (date='".date('Y-m-d')."' OR everyday=1) AND hour='".date('G')."' AND minute='".date('i')."'");

    while(
$each mysql_fetch_array($sql)) {

        
$result Twitter::sendTwitter(stripslashes($username),stripslashes($password),$each['message']);
        
        if(
$each['date']) mysql_query("DELETE FROM messages WHERE id='".$each['id']."'");

    }


}

mysql_query("DELETE FROM messages WHERE date!='' AND date<'".date('Y-m-d')."'");



class 
Twitter
{
function 
Twitter() {
die(
'Cannot instantiate this class(Twitter) in: '.__FILE__);
}

/**
* Attempts to contact twitter and post a message
*
* @param string $uname = Twitter User Name
* @param string $pWord = Twitter Password
* @param string $message = The message to post through the communication system
* @param string $apiUrl = Twitter API Url. (Optional - defaulted to standard XML API)
* @return boolean
**/
function sendTwitter($uName='',$pWord='',$message='',$apiUrl='http://twitter.com/statuses/update.xml')
{
$curl_handle curl_init();
curl_setopt($curl_handleCURLOPT_URL"$apiUrl");
curl_setopt($curl_handleCURLOPT_CONNECTTIMEOUT2);
curl_setopt($curl_handleCURLOPT_RETURNTRANSFER1);
curl_setopt($curl_handleCURLOPT_POST1);
curl_setopt($curl_handleCURLOPT_POSTFIELDS"status=$message");
curl_setopt($curl_handleCURLOPT_USERPWD"$uName:$pWord");
//Attempt to send
$buffer curl_exec($curl_handle);
curl_close($curl_handle);
if(
strpos($buffer,'<error>') !== false)
{
return 
false;
}
else
{
return 
true;
}
}


}

?>


Ben bezig met een Auto Tweet script.
Hij moet om de 5 minuten cron.php uitvoeren.


Met vriendelijke groet,
Mazlum Bölek.
09-05-2011 19:57
Dit topic is 222 keer bekeken door 44 verschillende leden
Reacties op: "Cronjobs"
1
world-of-maffia.nl
Berichten: 744
avatar
Offline Stuur privébericht
Misschien heb je hier wat aan:

http://www.htmlcenter.com/blog/running-php-scripts-with-cron/

Mvg Mick
09-05-2011 21:12
What else?
Berichten: 1180
avatar
Online Stuur privébericht
En anders zijn er altijd online oplossingen voor:
http://www.onlinecronjobs.com/

altijd handig
09-05-2011 22:41
Reageer op: "Cronjobs"
1
Je kan niet reageren omdat je niet bent ingelogd. Inloggen of Aanmelden