Appzmaster Posted August 14, 2009 Share Posted August 14, 2009 I have a script that updates a users status on twitter based on their xbox live info it works all great but I need to implement something that will allow it to only update users status if their xbox live status is online else it just spams the account away. I am pretty new to using arrays and what not so I am not really sure where to start with having it check that condition and if they are offline it would just skip to the next user in the database and not run the update on their account. Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/ Share on other sites More sharing options...
Adam Posted August 14, 2009 Share Posted August 14, 2009 What code do you have so far? Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/#findComment-898191 Share on other sites More sharing options...
Appzmaster Posted August 14, 2009 Author Share Posted August 14, 2009 Well here is what actually updates the twitter status it connects to the db further up and uses a while to run this stuff require("config/config.php"); require("config/opendb.php"); require ("Twitter.class.php"); //Grab content from MySQL $data = mysql_query("SELECT * FROM users") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $data )) { // check whether get variables are existing and read xml file if (file_exists($path.$file)) { $xml = simplexml_load_file($path.$file); $xbltweet2 = $xml->Gamertag; $xbltweet = $xml->PresenceInfo->Info; $xbltweet1 = $xml->PresenceInfo->Info2; //if ($xml->PresenceInfo->Online == false){ //Some Code Once I figure It Out //}else{ //data to get $tuser = $row[twitteruser]; $tpassword = $row[twitterpass]; //echo $tuser $tweet = new Twitter("$tuser", "$tpassword"); // Set a new status. This can be called multiple times on the same object. // The update() function returns true if the status update was successful or // false if an error occured. In case of an error, a string describing the error // is stored in the error variable of the object (in our case $tweet->error) $success = $tweet->update("$xbltweet2 : $xbltweet : $xbltweet1"); if ($success) echo "Tweet successful!"; echo $tweet->error; } } Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/#findComment-898209 Share on other sites More sharing options...
Appzmaster Posted August 14, 2009 Author Share Posted August 14, 2009 Maybe using a continue; ? Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/#findComment-898448 Share on other sites More sharing options...
Appzmaster Posted August 15, 2009 Author Share Posted August 15, 2009 I guess I am on my own with this one. Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/#findComment-899016 Share on other sites More sharing options...
Adam Posted August 18, 2009 Share Posted August 18, 2009 You've not exactly given the clearest of explanations to be fair. Try this: <?php require("config/config.php"); require("config/opendb.php"); require ("Twitter.class.php"); //Grab content from MySQL $data = mysql_query("SELECT * FROM users") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $data )) { // check whether get variables are existing and read xml file if (file_exists($path.$file)) { $xml = simplexml_load_file($path.$file); $xbltweet2 = $xml->Gamertag; $xbltweet = $xml->PresenceInfo->Info; $xbltweet1 = $xml->PresenceInfo->Info2; if ($xml->PresenceInfo->Online == true){ //data to get $tuser = $row[twitteruser]; $tpassword = $row[twitterpass]; //echo $tuser $tweet = new Twitter("$tuser", "$tpassword"); // Set a new status. This can be called multiple times on the same object. // The update() function returns true if the status update was successful or // false if an error occured. In case of an error, a string describing the error // is stored in the error variable of the object (in our case $tweet->error) $success = $tweet->update("$xbltweet2 : $xbltweet : $xbltweet1"); if ($success) echo "Tweet successful!"; echo $tweet->error; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/170254-xbox-live-twitter-status-update/#findComment-900773 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.