New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: PowerShell

secure tweet from powershell

111 Views
Copy Code Show/Hide Line Numbers
function Send-Tweet {
    param ([string]$tweet)
    $twitUrl = "https://twitter.com/statuses/update.xml"
    $str = "status="  + $Tweet
    Post-Twitter $twitUrl $str
}
 
function Send-DirectTweet {
    param ([string]$tweet,[string]$recipient)
    $twitUrl = "https://twitter.com/direct_messages/new.xml"
    $str = "text="  + $tweet + "&user=" + $recipient
    Post-Twitter $twitUrl $str
}
 
function Post-Twitter {
    param ([string]$twitUrl,[string]$str)
    
    $WebClient = New-Object System.Net.WebClient
 
    try{
        $WebClient.Credentials = Get-Credential -Credential "kentelmer"
        [System.Net.ServicePointManager]::Expect100Continue = $false
        $response = $WebClient.UploadString($twitUrl,$str)
        #$response
    } catch {
        write-host "Error text: " $_
        write-host "Exception: " $_.Exception.GetType()
    } finally {
        $WebClient.Dispose
    }
}
by
  January 18, 2010 @ 5:49pm
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate