The Web component allows you to post text and files to the web through the PostText, PostTextWithEncoding, PostFile, and UploadImage blocks.
PostText
To successfully post text or a file, the Web component URL property must be set to the URL where you wish to send your post. To post text, add the text you wish to send to the PostText block in the text socket.
PostTextWithEncoding
To post text with a character encoding other than the default UTF-8, you can use the PostTextWithEncoding block. Add the text you want to post to the text socket, and a valid character set (charset) encoding to the encoding socket.
Table 1. Common Character Sets
Common Charsets |
UTF-8 |
UTF-16 |
ISO-8859-1 |
US-ASCII |
PostFile
To post a file, the Request Headers must be set to reflect the type of file you are sending. A Request Headers is represented as a two-item list composed of a key value pair. You must add a header with a text key value pair -- Content-Type (case sensitive) and the internet media type that represents the kind of file being sent (Table 2). You can include additional Request Headers before or after the Content-Type header, but only the Content-Type header is necessary. To post the file, use the PostFile block and add the path of the file on the phone to the path socket.
Table 2. Common Internet Media Types:
File Type | Internet Media Type |
GIF image | image/gif |
JPEG image | image/jpeg |
PNG image | image/png |
JSON text | application/json |
application/pdf | |
ZIP archive file | application/zip |
MP4 audio | audio/mp4 |
MP3 or other MPEG audio | audio/mpeg |
WAV audio | audio/vnd.wave |
Windows Media Audio | audio/x-ms-wma |
CSS text | text/css |
CSV | text/csv |
HTML | text/html |
plain text | text/plain |
The Web Component allows you to upload photos and images to an account on Flickr, Picasa, or Facebook through the UploadImage block. The images that you upload will be associated with the account that the user logs in to once the block is executed. To upload a photo you must first register your app with the service you want to use.
Picasa Registration:
Flickr Registration:
Facebook Registration:
Once you have registered your app and have a valid consumer key and secret, you are ready to use the UploadImage block. In your UploadImage block, add the service you wish to use (flickr, picasa, or facebook) in the service socket and the path of the file on the phone to the path socket. Copy your consumer key and secret into the appropriate sockets in the block. Make sure they appear exactly as they were given from the service.