<?php

$id = "username";
$pw = "password";
$postfields = "UserLogin=$id&UserPassword=$pw&press=login";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1); // Get the header
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie");
curl_setopt($ch, CURLOPT_URL,
"http://www5.apa.org/membership/login/login.cfm");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$postfields");

curl_exec($ch);
curl_close($ch);
?>