Created
January 30, 2012 15:10
-
-
Save tkh44/1704888 to your computer and use it in GitHub Desktop.
Working PHP connect to Netsuite.
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 | |
extract($_POST); | |
$url = 'https://forms.netsuite.com/app/site/hosting/scriptlet.nl'; | |
$fields = array( | |
'firstname' => urlencode($firstname), | |
'lastname' => urlencode($lastname), | |
'email' => urlencode($email), | |
'phone' => urlencode($telephone), | |
'mobilephone' => urlencode($alttelephone), | |
'custentity_date_of_birth' => urlencode($dob), | |
'custentity_gender_free_form' => urlencode($gender), | |
'address_state' => urlencode($state), | |
'is_person' => urlencode(T), | |
'deploy' => urlencode(1), | |
'compid' => urlencode(1128553), | |
'h' => urlencode(c648b689db7d6015c7c7), | |
'globalsubscriptionstatus' => urlencode(1), | |
'leadsource' => urlencode(194926), | |
'address_country' => urlencode(US), | |
'script' => urlencode(8) | |
); | |
foreach($fields as $key => $value) { $fields_string .= $key.'='.$value.'&';} | |
rtrim($fields_string, '&'); | |
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$url); | |
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); | |
curl_setopt($ch, CURLOPT_POST, count($fields)); | |
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment