weather; $forecast_conditions0 = $weather->forecast_conditions[0]; $forecast_conditions1 = $weather->forecast_conditions[1]; $forecast_conditions2 = $weather->forecast_conditions[2]; $forecast_conditions3 = $weather->forecast_conditions[3]; $day_of_week0 = $forecast_conditions0->day_of_week; $low0 = $forecast_conditions0->low; $high0 = $forecast_conditions0->high; $day0 = $day_of_week0['data']; $tl0 = $low0['data']; $th0 = $high0['data']; $text0 = "$day0: Alta: $th0 Baja: $tl0 "; $day_of_week1 = $forecast_conditions1->day_of_week; $low1 = $forecast_conditions1->low; $high1 = $forecast_conditions1->high; $day1 = $day_of_week1['data']; $tl1 = $low1['data']; $th1 = $high1['data']; $text1 = "$day1: Alta: $th1 °C Baja: $tl1 °C "; $day_of_week2 = $forecast_conditions2->day_of_week; $low2 = $forecast_conditions2->low; $high2 = $forecast_conditions2->high; $day2 = $day_of_week2['data']; $tl2 = $low2['data']; $th2 = $high2['data']; $text2 = "$day2: Alta: $th2 °C Baja: $tl2 °C "; $day_of_week3 = $forecast_conditions3->day_of_week; $low3 = $forecast_conditions3->low; $high3 = $forecast_conditions3->high; $day3 = $day_of_week3['data']; $tl3 = $low3['data']; $th3 = $high3['data']; $text3 = "$day3: Alta: $th3 °C Baja: $tl3 °C "; $texto = "Pronostico: $text0 | $text1 | $text2 | $text3 "; $message = "$texto "; // Set username and password $username = 'usuario'; $password = 'contraseņa'; // The twitter API address $url = 'http://twitter.com/statuses/update.xml'; // Alternative JSON version // $url = 'http://twitter.com/statuses/update.json'; // Set up and execute the curl process $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "$url"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message"); curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); // check for success or failure if (empty($buffer)) { echo 'message'; } else { echo "sucess"; } ?>