Thanks. I should have mentioned that the password is not real (changed the data, but kept the format to illustrate what exactly is being used).
On Jul 27, 11:30 am, JDG <[email protected]> wrote: > a) the POST body (i.e. track=Palin) must come after ALL headers. > b) change your password, you just sent it to the whole dev community. > > > > On Mon, Jul 27, 2009 at 12:18, Joseph <[email protected]> wrote: > > > I am trying to use the track streaming API, but I'm having trouble > > with the syntax. The example shows how to use a tracking list stored > > in a file in the format: track = word1, word2, etc.. > > > I tried the following (following a successful fsockopen call to > > stream.twitter.api: > > > POST /track.json track = Palin, #fubar HTTP/1.1 Host: > > stream.twitter.com User-Agent: UserAgent Authorization: Basic > > cGXybmFzc3TzZGV2OlBhcm5hMzT1Mzl4MDMz Connection: Close > > > and I am getting the following error code: HTTP/1.1 400 Bad Request > > > The actual relevant test PHP code is: > > > $fp = fsockopen($url, 80, $errno, $errstr, 30); > > if (!$fp) { > > echo "$errstr ($errno)\n"; > > } else { > > echo "file handle: ".$fp."<br/>"; > > $header = "POST /track.json track = $trackTerms HTTP/1.1\r\n"; > > $header .= "Host: stream.twitter.com\r\n"; > > $header .= "User-Agent: UserAgent\r\n"; > > $header .= "Authorization: Basic " . base64_encode($twitUsername . > > ':' . $twitPwd)."\r\n"; > > $header .= "Connection: Close\r\n\r\n"; > > echo $header."<br/>"; > > fwrite($fp, $header); > > $line = fgets($fp, 4096); > > echo $line; > > fclose($fp); > > } > > -- > Internets. Serious business.
