UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  eUKhost's Official Web Hosting Forum > Services > Web Designing and Development

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 18-11-2008, 18:10
Daniel's Avatar
Got root?
 
Join Date: Aug 2008
Location: England, UK
Posts: 179
Send a message via MSN to Daniel Send a message via Skype™ to Daniel
Default Anybody handy with PHP?

I have a piece of code, I'm not sure if you know what twitter is.. but it allows you to update your status.

Anyway sometimes twitter goes down and that means that my blog won't load... below is the current piece of code but I was wondering if you could fix it so that if twitter.com is down it will echo a different message?

PHP Code:
<?PHP
 $twitter_url 
"http://twitter.com/statuses/user_timeline/DanMillerUK.xml?count=1";

    

$buffer file_get_contents($twitter_url);

$xml = new SimpleXMLElement($buffer);


    

$status_item $xml -> status;

$status =  $status_item -> text;

 

echo 
$status;
?>
If you could do the above I would really appreciate it!

Thanks in advance,
Dan
__________________
Dan Miller
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 18-11-2008, 18:32
flesso's Avatar
Premium Member
 
Join Date: Mar 2007
Location: 127.0.0.1
Posts: 1,652
Default

PHP Code:

<?PHP

$twitter_site 
"www.twitter.com";
$site_check fsockopen($twitter_site8010);

if (!
$site_check) {

$status "Twitter is unavailable at this moment in time.";

} else {

$twitter_url "http://twitter.com/statuses/user_timeline/DanMillerUK.xml?count=1";

$buffer file_get_contents($twitter_url);

$xml = new SimpleXMLElement($buffer);

$status_item $xml -> status;

$status =  $status_item -> text;

}

echo 
$status;

?>
Something along those lines I would think...
__________________
Josh

Resident Blogger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 18-11-2008, 18:38
Daniel's Avatar
Got root?
 
Join Date: Aug 2008
Location: England, UK
Posts: 179
Send a message via MSN to Daniel Send a message via Skype™ to Daniel
Default

Fatal error: Only variables can be passed by reference in /home/danm/public_html/status3.php on line 4
__________________
Dan Miller
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 18-11-2008, 18:50
flesso's Avatar
Premium Member
 
Join Date: Mar 2007
Location: 127.0.0.1
Posts: 1,652
Default

PHP Code:

<?php
 
    $site_check 
fsockopen ("www.twitter.com"80);
    
    if (!
$site_check) {
    
        echo 
"Twitter is currently unavailable.";
        
    } else {
    
        
$twitter_url "http://twitter.com/statuses/user_timeline/DanMillerUK.xml?count=1";
    
        
$buffer file_get_contents($twitter_url);
        
$xml = new SimpleXMLElement($buffer);
        
        
$status_item $xml -> status;
        
$status =  $status_item -> text;
        
    }
    
    
fclose($site_check);
    
    echo 
$status;
    
?>
That seems to work here now.
__________________
Josh

Resident Blogger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 18-11-2008, 18:54
flesso's Avatar
Premium Member
 
Join Date: Mar 2007
Location: 127.0.0.1
Posts: 1,652
Default

See the attached screenshot.

I take it that's your Twitter feed?
Attached Images
File Type: jpg twitter.jpg (8.6 KB, 9 views)
__________________
Josh

Resident Blogger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 18-11-2008, 19:17
DPS Computing's Avatar
Moderator
 
Join Date: Apr 2007
Location: Manchester, United Kingdom
Posts: 7,504
Send a message via ICQ to DPS Computing Send a message via AIM to DPS Computing Send a message via MSN to DPS Computing Send a message via Yahoo to DPS Computing Send a message via Skype™ to DPS Computing
Default

That screenshot is a little small - even when magnified .
__________________
David Smith
DPS Computing
http://www.dpscomputing.com (Computing, Reviews, News) - We're still plodding on adding new content and features (August 2011)
http://www.djdavid.co.uk - Massive update! (September 2011) - It's now not neglected!!
http://davidsmith.dpscomputing.com (My Personal Website) - New Site (10/2009)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 22:41.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
UK Web Hosting by eUKHosting 3.1.0
UK Web Hosting by eUKHosting 3.1.0
Copyright © 2001-2012, eUKhost LTD. All rights reserved.

 


UK VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

VoIP Dedicated Servers
Asterisk, Trixbox Dedicated Servers

Business Web Hosting
100% uptime Hosting

UK Cpanel Hosting
cPanel Shared Hosting

Domain Hosting
Cheap Domains & Hosting Plans

UK Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

ColdFusion Hosting
ColdFusion Web Hosting
 
 

Android and Apple App


knowledgebase articles
eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting

Joomla Hosting
Joomla Web Hosting

Mambo Hosting
Mambo Web Hosting

Magento Hosting
Magento Web Hosting

Wordpress Hosting
Wordpress Web Hosting

 

Web Hosting Affiliate Program
 

popular blog categories

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles