Is er iemand die ervaringen heeft met Twitter API van de NS?
Codeblok (cronjob.php):
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
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
$username = username weggehaald; // gebruikersnaam van de ns api, staat in je mail
$password = wachtwoord wegehaald; // wachtwoord van de ns api, staat ook in je mail
$target_url = http://webservices.ns.nl/ns-api-storingen?actual=true&unplanned=true;
require_once(NS.php);
require_once(cache/FileCache.php);
$retriever = new cURLRetriever($username, $password);
$cache = new FileCache($retriever, "tmp");
$ns = new NS($cache);
$stations = $ns->getStoringen(, true, true);
if($stations->getPeriode() == && $stations->getAdvies() == ) {
$unplanned = true;
}else{
$unplanned = false;
}
if($unplanned) {
$tweet = Er vindt op .$stations->getDatum(). een ongeplande storing plaats!;
}else{
$tweet = Er vindt tijdens .$stations->getPeriode(). een geplande storing plaats! Advies: .$stations->getAdvies();
}
$httpc = $connection->http_code;
if($httpc == 200) {
echo succesvol;
} else {
echo "Twitterfout: ".$result->error;
}
?>
toevoeging op 15 augustus 2013, 17:06:59:
// er zit iets fout in cronjob.php, weten jullie wat er fout aan is?
Codeblok (cronjob.php):
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
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
$username = username weggehaald; // gebruikersnaam van de ns api, staat in je mail
$password = wachtwoord wegehaald; // wachtwoord van de ns api, staat ook in je mail
$target_url = http://webservices.ns.nl/ns-api-storingen?actual=true&unplanned=true;
require_once(NS.php);
require_once(cache/FileCache.php);
$retriever = new cURLRetriever($username, $password);
$cache = new FileCache($retriever, "tmp");
$ns = new NS($cache);
$stations = $ns->getStoringen(, true, true);
if($stations->getPeriode() == && $stations->getAdvies() == ) {
$unplanned = true;
}else{
$unplanned = false;
}
if($unplanned) {
$tweet = Er vindt op .$stations->getDatum(). een ongeplande storing plaats!;
}else{
$tweet = Er vindt tijdens .$stations->getPeriode(). een geplande storing plaats! Advies: .$stations->getAdvies();
}
$httpc = $connection->http_code;
if($httpc == 200) {
echo succesvol;
} else {
echo "Twitterfout: ".$result->error;
}
?>
toevoeging op 15 augustus 2013, 17:06:59:
// er zit iets fout in cronjob.php, weten jullie wat er fout aan is?

, $_POST[namen]