archiv:coding:php:stwitterapi

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
archiv:coding:php:stwitterapi [2023/11/05 22:48] psycorearchiv:coding:php:stwitterapi [2023/11/08 13:09] (aktuell) – gelöscht psycore
Zeile 1: Zeile 1:
-{{template>vorlagen:delete}} 
  
-====== Secure twitter API ====== 
- 
-Secure twitter API kann Statusmeldungen von [[http://twitter.com]] ändern. 
- 
-===== twitter.php ===== 
- 
-<code php twitter.php> 
-<?php 
-/* ---------------------------------------- */ 
-// Change these parameters with your Twitter  
-// user name and Twitter password. 
-/* ---------------------------------------- */ 
-$twitter_username = 'username'; 
-$twitter_psw = 'password'; 
-//noch nicht integriert 
-$myself = 'twitter.php'; 
-/* ---------------------------------------- */ 
- 
-/* Don't change the code belove 
-/* ---------------------------------------- */ 
-require('twitterAPI.php'); 
-if(isset($_POST['twitter_msg'])){ 
- $twitter_message=$_POST['twitter_msg']; 
- if(strlen($twitter_message)<1){ 
- $error=1; 
- } else { 
- $twitter_status=postToTwitter($twitter_username, $twitter_psw, $twitter_message); 
- } 
-} 
-/* ---------------------------------------- */ 
-?> 
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
-<html xmlns="http://www.w3.org/1999/xhtml"> 
-<head> 
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
-<title>Secure twitter.com API v0.1</title> 
-<style type="text/css"> 
-body{font-family:'Lucida Grande', Verdana, sans-serif;; font-size:14px; color:#666666;} 
-h2{color:#000000;} 
-h3{color:#000000; font-size:14px;} 
-p{font-size:12px; color:#333333;} 
-input{font-size:18px; color:#444444;} 
-a:link, a:visited, a:hover{color:#0033CC;} 
-a:hover{text-decoration:none;} 
-div.footer{padding:6px; border-top:solid 1px #DEDEDE; font-size:10px;} 
-div.msg{background:#FFFFCC; margin-bottom:10px; padding:4px;} 
-div.code{padding:10px; background:#FFFFCC; font-size:11px; color:#000000; margin-bottom:20px; width:300px; border:solid 1px #CCCCCC;} 
-</style> 
-</head> 
- 
-<body> 
-<h2>Secure twitter API</h2> 
-<p>Status Nachricht eingeben:</p> 
-<!-- This is the form that you can reuse in your site --> 
-<?php if(isset($_POST['twitter_msg']) && !isset($error)){?> 
-<div class="msg"><?php echo $twitter_status ?></div> 
-<?php } else if(isset($error)){?> 
-<div class="msg">Error: please insert a message!</div> 
-<?php }?> 
-<p><strong>What are you doing?</strong></p> 
-<form action="twitter.php" method="post"> 
-<input name="twitter_msg" type="text" id="twitter_msg" size="40" maxlength="140" /> 
-<input type="submit" name="button" id="button" value="post" /> 
-</form> 
-<!-- END --> 
- 
-<div class="footer"> 
-For info please visit <a href="https://secure.hellhost.de/wiki/php:stwitterapi">Secure twitter API</a> Original Code by: <a href="mailto:antonio.lupetti@gmail.com">antonio.lupetti@gmail.com</a> 
-<br /> 
-</div> 
- 
-</body> 
-</html> 
-</code> 
- 
-===== twitterAPI.php ===== 
- 
-<code php> 
-<?php 
- 
-// A simple function using Curl to post (GET) to Twitter 
-// Kosso : March 14 2007 
- 
-function postToTwitter($username,$password,$message){ 
- 
-    $host = "https://twitter.com/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message))); 
- 
-    $ch = curl_init(); 
-    curl_setopt($ch, CURLOPT_URL, $host); 
-    curl_setopt($ch, CURLOPT_VERBOSE, 1); 
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
-    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); 
-    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
-    curl_setopt($ch, CURLOPT_POST, 1); 
-    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); 
- 
-    $result = curl_exec($ch); 
-    // Look at the returned header 
-    $resultArray = curl_getinfo($ch); 
- 
-    curl_close($ch); 
- 
-    if($resultArray['http_code'] == "200"){ 
-         $twitter_status='Your message has been sended! <a href="https://twitter.com/'.$username.'">See your profile</a>'; 
-    } else { 
-         $twitter_status="Error posting to Twitter. Retry"; 
-    } 
- return $twitter_status; 
-} 
-?> 
-</code> 
  • archiv/coding/php/stwitterapi.1699220903.txt.gz
  • Zuletzt geändert: 2023/11/05 22:48
  • von psycore