comparison twitter/simpleTest.php @ 6:077b0a0a3e6d

remaining originals according to dependency walk
author Robert Boland <robert@markup.co.uk>
date Thu, 16 Feb 2017 22:29:02 +0000
parents
children
comparison
equal deleted inserted replaced
5:55445b456ad0 6:077b0a0a3e6d
1 <?php
2 include 'EpiCurl.php';
3 include 'EpiOAuth.php';
4 include 'EpiTwitter.php';
5 $consumer_key = 'jdv3dsDhsYuJRlZFSuI2fg';
6 $consumer_secret = 'NNXamBsBFG8PnEmacYs0uCtbtsz346OJSod7Dl94';
7 $token = '25451974-uakRmTZxrSFQbkDjZnTAsxDO5o9kacz2LT6kqEHA';
8 $secret= 'CuQPQ1WqIdSJDTIkDUlXjHpbcRao9lcKhQHflqGE8';
9 $twitterObj = new EpiTwitter($consumer_key, $consumer_secret, $token, $secret);
10 $twitterObjUnAuth = new EpiTwitter($consumer_key, $consumer_secret);
11 ?>
12
13 <h1>Single test to verify everything works ok</h1>
14
15 <h2><a href="javascript:void(0);" onclick="viewSource();">View the source of this file</a></h2>
16 <div id="source" style="display:none; padding:5px; border: dotted 1px #bbb; background-color:#ddd;">
17 <?php highlight_file(__FILE__); ?>
18 </div>
19
20 <hr>
21
22 <h2>Generate the authorization link</h2>
23 <?php echo $twitterObjUnAuth->getAuthenticateUrl(); ?>
24
25 <hr>
26
27 <h2>Verify credentials</h2>
28 <?php
29 $creds = $twitterObj->get('/account/verify_credentials.json');
30 ?>
31 <pre>
32 <?php print_r($creds->response); ?>
33 </pre>
34
35 <hr>
36
37 <h2>Post status</h2>
38 <?php
39 $status = $twitterObj->post('/statuses/update.json', array('status' => 'This a simple test from twitter-async at ' . date('m-d-Y h:i:s')));
40 ?>
41 <pre>
42 <?php print_r($status->response); ?>
43 </pre>
44
45 <script> function viewSource() { document.getElementById('source').style.display=document.getElementById('source').style.display=='block'?'none':'block'; } </script>
46