Hey one2xs,
Ik ben bezig om een twitter in mn site te zetten en probeer voor de grap de tijd te tweeten.
Dit lukt half.
Ik heb alles ingevuld, maar hij tweet ook mijn code mee, hoe kan ik de tekst incl. die date(); gebeuren erin tweeten?
Bvd,
Nielsjojo
Ik ben bezig om een twitter in mn site te zetten en probeer voor de grap de tijd te tweeten.
Dit lukt half.
Ik heb alles ingevuld, maar hij tweet ook mijn code mee, hoe kan ik de tekst incl. die date(); gebeuren erin tweeten?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #FF8000]//config[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]CONSUMER_KEY[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"*************"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]CONSUMER_SECRET[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"*************"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]OAUTH_TOKEN[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"*******************"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]OAUTH_TOKEN_SECRET[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"*******************"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// Download dit: https://github.com/abraham/twitteroauth[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]twitteroauth/twitteroauth.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$connection[/COLOR] [COLOR= #007700]= new[/COLOR] TwitterOAuth[COLOR= #007700]([/COLOR]CONSUMER_KEY[COLOR= #007700],[/COLOR] CONSUMER_SECRET[COLOR= #007700],[/COLOR] OAUTH_TOKEN[COLOR= #007700],[/COLOR] OAUTH_TOKEN_SECRET[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$connection[/COLOR][COLOR= #007700]->[/COLOR]post[COLOR= #007700]([/COLOR][COLOR= #DD0000]statuses/update[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]status[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]"Het is" .date([/COLOR]Y[COLOR= #007700]-[/COLOR]m[COLOR= #007700]-[/COLOR]d H[COLOR= #007700]:[/COLOR]i[COLOR= #007700]:[/COLOR]s[COLOR= #DD0000]). "!"[/COLOR][COLOR= #007700]));[/COLOR]
[COLOR= #0000BB]$httpc[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$connection[/COLOR][COLOR= #007700]->[/COLOR]http_code[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$httpc[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]200[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]succesvol[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Twitterfout: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]->[/COLOR]error[COLOR= #007700];
}[/COLOR]
?> Bvd,
Nielsjojo