Post to Twitter?

If you want to get your Arduino to talk to the internet without using an ethernet controller you need'll to use a proxy running on your PC.

Your Arduino is plugged into your PC and the sketch running on the Arduino talks over the serial line to a program running on the PC.

The program running on the PC then talks over the broadband line to a program running on the internet, i.e. your PHP script.

The bit in the middle, talking on both serial line and broadband line is called a proxy. You can write it in any language: Visual Basic, Perl, Java, yada yada. The following uses Processing since this will be somewhat familiar to Arduino coders.

The following is a very simple demonstration of this.

Arduino Sketch - this opens a connection on the serial line between the Arduino and your PC and writes the word "Tick" every five seconds.

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Tick");
delay(5000);
}

Processing Sketch: this runs on your PC and opens the other end of the serial line to the Arduino. Everytime the Arduino writes something (anything) this sketch opens a connection to your PHP script. (We don't really care what the PHP script does or says so we don't bother reading the stream.)

import java.net.;
import processing.serial.
;

Serial theSerial;

void setup() {
theSerial = new Serial(this, Serial.list()[0], 9600);
}

void draw() {
if (theSerial.available() > 0) {
theSerial.readString();
try {
new URL("tick.php").openStream();
}
catch (Exception theException) {
theException.printStackTrace();
}
}
}

PHP Script: this sits on your web-server and, everytime it is called, increments the contents of the text file:

<?php file_put_contents("tick.txt", file_get_contents("tick.txt") + 1); ?>

Another PHP Script: this sits on your web-server and, everytime it is called, displays the contents of the text file - you could use this for debugging:

<?php echo file_get_contents("tick.txt"); ?>