Created
June 17, 2011 14:48
-
-
Save willcroft/1031563 to your computer and use it in GitHub Desktop.
Cross-post to Eloqua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Post this request to Eloqua (ugh) as well | |
| $data = array | |
| ( | |
| 'elqFormName' => '', // Required: name of Eloqua form | |
| 'elqSiteID' => '', // Required: Eloqua site id | |
| 'elqCustomerGUID' => '', | |
| 'elqCookieWrite' => '0', | |
| 'C_FirstName' => urlencode($this->subscribe['first_name']), | |
| 'C_LastName' => urlencode($this->subscribe['last_name']), | |
| 'C_EmailAddress' => urlencode($this->subscribe['email']), | |
| 'C_Home_Country1' => urlencode($this->subscribe['country']) | |
| ); | |
| // Convert data | |
| $data_string = array(); | |
| while(list($n, $v) = each($data)) | |
| { | |
| $data_string[] = $n.'='.$v; | |
| } | |
| $data_string = implode('&', $data_string); | |
| // Open a socket connection on port 80 | |
| $url = parse_url('http://now.eloqua.com/e/f.aspx'); | |
| $fp = fsockopen($url['host'], 80); | |
| // Send the request headers | |
| fputs($fp, "POST ".$url['path']." HTTP/1.1\r\n"); | |
| fputs($fp, "Host: ".$url['host']."\r\n"); | |
| fputs($fp, "Referer: ".$this->site['url']."/subscribe/\r\n"); | |
| fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); | |
| fputs($fp, "Content-length: ".strlen($data_string)."\r\n"); | |
| fputs($fp, "Connection: close\r\n\r\n"); | |
| fputs($fp, $data_string); | |
| // Close the socket connection | |
| fclose($fp); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment