Posting From Scripts
I recently got a new phone - one that takes video and photos and can e-mail these out. My goal was to post photos from my phone.
Short Version:
Initially, i wanted to write a script to do this, but couldn't get the interface to blogger working, so instead tried blogger's "go@blogger.com" solution. That didn't work either, i went back to working on a script, and finally got the script bit figured out. The two previous posts were done from my phone.
Longer Version:
I was hoping to be able to simply submit a post via e-mail. I have a wrapper script for an e-mail address on my server that parses messages from my phone, retrieves the photo and text, scales down the photo, and then e-mails blogger with an html img tag and the text. Blogger translated the tags into html entities, so i e-mailed them with a html encoding, and this mail was rejected.
Next i tried go@blogger.com, which is supposed to take picture mail from various providers, including mine, but kept getting Mail Delivery errors:
Command died with status 1: " /home/bloggermail/mail_2_blogger.par www-internal.blogger.com:80 2>>/home/bloggermail/m2b-output.log"
Then i tried using perl's XML::Atom (v 0.11) module to post, but the script would die reporting a 500 Server Error. I followed the actual tcp connection and saw that it was really getting a 401 error, and the following:
I'm sorry, we only support BASIC Authentication over SSL
Looking at the rest of the connection, i noticed that indeed the auth bit generated by XML::Atom was different than what blogger wanted, according to their sample page.
So i followed their sample page and tried to manually connect by 'telnet www.blogger.com 80' and typing in the correct data. Retrieving data worked (and i believe my auth string is correct since if i changed it i would get a "login failed" message), but posting data died with this Java error:
Exception caught but no reason given: java.io.EOFException
which led me to believe that something is wrong in their Atom implementation.
Finally i tried perl's Net::Blogger module, which implies that XML::Atom should be used instead (as do most blogger pages - the reason i didn't try Net::Blogger first). There is also a link from the Net::Blogger docs to the blogger API, and this API page states that it is no longer developed but still supported.
Sure enough, using Net::Blogger works to post messages to blogger. According to this page, blogger should accept html encoded pages, so perhaps i will again explore that later. For now, i'd like to get some speech-to-text cli software working so i can send a voice message to my e-mail that gets translated into the text of the post, instead of having to type in on my phone, and i need to come up with a way to add instructions on image editing to my text message, so the image can be cropped/lightened/etc.
Short Version:
Initially, i wanted to write a script to do this, but couldn't get the interface to blogger working, so instead tried blogger's "go@blogger.com" solution. That didn't work either, i went back to working on a script, and finally got the script bit figured out. The two previous posts were done from my phone.
Longer Version:
I was hoping to be able to simply submit a post via e-mail. I have a wrapper script for an e-mail address on my server that parses messages from my phone, retrieves the photo and text, scales down the photo, and then e-mails blogger with an html img tag and the text. Blogger translated the tags into html entities, so i e-mailed them with a html encoding, and this mail was rejected.
Next i tried go@blogger.com, which is supposed to take picture mail from various providers, including mine, but kept getting Mail Delivery errors:
Then i tried using perl's XML::Atom (v 0.11) module to post, but the script would die reporting a 500 Server Error. I followed the actual tcp connection and saw that it was really getting a 401 error, and the following:
I'm sorry, we only support BASIC Authentication over SSL
Looking at the rest of the connection, i noticed that indeed the auth bit generated by XML::Atom was different than what blogger wanted, according to their sample page.
So i followed their sample page and tried to manually connect by 'telnet www.blogger.com 80' and typing in the correct data. Retrieving data worked (and i believe my auth string is correct since if i changed it i would get a "login failed" message), but posting data died with this Java error:
Exception caught but no reason given: java.io.EOFException
which led me to believe that something is wrong in their Atom implementation.
Finally i tried perl's Net::Blogger module, which implies that XML::Atom should be used instead (as do most blogger pages - the reason i didn't try Net::Blogger first). There is also a link from the Net::Blogger docs to the blogger API, and this API page states that it is no longer developed but still supported.
Sure enough, using Net::Blogger works to post messages to blogger. According to this page, blogger should accept html encoded pages, so perhaps i will again explore that later. For now, i'd like to get some speech-to-text cli software working so i can send a voice message to my e-mail that gets translated into the text of the post, instead of having to type in on my phone, and i need to come up with a way to add instructions on image editing to my text message, so the image can be cropped/lightened/etc.
Labels: tech


3 Comments:
Using Content-Type: text/html and Content-Transfer-Encoding: quoted-printable headers, i can send html formatted e-mail to blogger. The bold tags, italic tags, etc show up correctly, with the exception of img tags, which generate the error:
Blogger does not accept message/rfc822 files.
A workaround is to use embed tags, which pass through and can show images as well.
Even script tags are allowed through, so perhaps those could be used to print out img tags as well. I wonder why blogger blocks img tags when the rest are allowed through.
hey dude, what kind of phone do you have?, i mean model, etc.
Sanyo MM-7400 with service from Sprint.
Post a Comment
<< Home