Hi Guys,
Let me first state that I’m quite new to the whole app development scene. With some help of my dear friend Google I managed to create a nice twitter feed for my clients website. I used my own web hosting provider while developing the site, and everything worked perfectly. When I moved the complete site, with working app, to the clients web provider the app stopped working!
I can’t seem to find the exact error, that’s why I wanted to ask you guys for help. I’ll post as much information as I can. So I used PHP to build the site and I use the following files for my app:
- Index.php
- Twitterfeed.php
So my index.php contains:
...
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script type="text/javascript" src="js/twitter-widget.js"></script>
...
<body>
<?php include_once("twitterfeed.php") ?>
...
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="TwitterContainer">
<tr>
<td align="left" valign="top">
<!-- Begin Twitter Feed Area -->
<div id="tweet"></div>
<!-- End Twitter Feed Area -->
</td>
</tr>
</table>
...
</body>
the Twitterfeed.php file contains the following code:
<?
require_once('TwitterAPIExchange.php');
$settings = array(
'oauth_access_token' => "***",
'oauth_access_token_secret' => "***",
'consumer_key' => "***",
'consumer_secret' => "***"
);
$url = 'https://api.twitter.com/1.1/statuses/mentions_timeline.json';
$getfield = '?count=5';
$requestMethod = 'get';
$twitter = new TwitterAPIExchange($settings);
$feed = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$cache = dirname(__FILE__) . '/cache/twitter-json.txt';
$last = filemtime($cache);
$now = time();
$interval = 3600; //update every hour
// check the cache file
if ( !$last || (( $now - $last ) > $interval) ) {
$cachefile = fopen($cache, 'w');
fwrite($cachefile,utf8_encode($feed));
fclose($cachefile);
//echo("Succesfully written to file");
}
?>
Final result is that my cache file is empty after this script has run. The web provider of my client already tested the connection from the server to Twitter, no problems there. Is there any other way of debugging or testing?
Thanks in advance!