Okay so I recently developed a wp childtheme for a website and in doing so I made a small function to grab the latest tweets:
This function works perfectly fine on my site (it's in the footer): http://codepier.com/pvsite/
But then when it loads on the site I need it to work on (http://pvhornetsnest.com/) I get the following output:
Why would it work on one site but not the other? Could it be the server? My site (codepier) is hosted with HostGator and the other (PVhornetsnest) is hosted with GoDaddy.
<?php //get tweets function getTwitterStatus($userid, $count){ echo '<div class="latestTweets"><h3>Latest Tweets</h3>'; $format='json'; // set format $tweet=json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/{$userid}.{$format}")); // get tweets and decode them into a variable $i = 1; echo '<ul>'; while ($i <= $count) { echo '<li><a href="http://twitter.com/' . $userid . '">' . $tweet[$i]->text . '</a></li>'; // show latest tweet $i++; } echo '</ul></div><!-- .latestTweets -->'; } ?>
This function works perfectly fine on my site (it's in the footer): http://codepier.com/pvsite/
But then when it loads on the site I need it to work on (http://pvhornetsnest.com/) I get the following output:
Warning: file_get_contents(http://api.twitter.com/1/statuses/user_timeline/pvei_ibpf.json) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/content/19/10381319/html/wp-content/themes/pvtheme/functions.php on line 233
Why would it work on one site but not the other? Could it be the server? My site (codepier) is hosted with HostGator and the other (PVhornetsnest) is hosted with GoDaddy.