Email subscription snippet form - send with PHP

Options

Hi there. I'm working for a client and they provide with an HTML snippet form for email subscription:

<br/><form action="http://wmf.convio.net/site/Survey" method="POST"><input id="cons_info_component" name="cons_info_component" type="hidden" value="t"><input id="SURVEY_ID" name="SURVEY_ID" type="hidden" value="1162"><input id="cons_email" maxlength="255" name="cons_email" onblur="if(this.value == ''){this.value='Email Address';}" onfocus="if(this.value == 'Email Address'){this.value='';}" size="14" type="email" value="Email Address" class="form-item email form-text form-email mti_font_element placeholder"><span style="display:none"><input alt="This field is used to prevent form submission by scripts." id="denySubmit" name="denySubmit" type="text" value="">Please leave this field empty</span><div class="form-actions"><input class="Button" id="ACTION_SUBMIT_SURVEY_RESPONSE" name="ACTION_SUBMIT_SURVEY_RESPONSE" type="submit" value="Submit">&nbsp;</div></form><br/>


Since the client needs several modofication, I tried to post this form with PHP, e.g.

<br/>$url = 'http://clientsite.convio.net/site/Survey';<br/>$reqArray = [<br/> 'cons_info_component' => 1,<br/> 'SURVEY_ID' => 1162,<br/> 'cons_email' => 'test@sometestdomain.com',<br/> 'denySubmit' => '',<br/> 'ACTION_SUBMIT_SURVEY_RESPONSE' => 'Submit'<br/>];<br/>$data = http_build_query($reqArray);<br/>$options = array(<br/> 'method' => 'POST',<br/> 'data' => $data,<br/> 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),<br/> );<br/>$response = drupal_http_request($url, $options);<br/> print "
". print_r($response,true) ."
";<br/>


but the email never reaches the luminate database.


The reponse I have contains among others:

<br/>...<br/> [code] => 200<br/> [redirect_code] => 302<br/> [redirect_url] => https://secure2.convio.net/wmf/site/SSurvey;jsessionid=00000000.app20020b?NONCE_TOKEN=B714225BDC87DF817168C73949C9A03D&null<br/>

Currently, I don't have access to the CRM, nor the logs, so any idea what's wrong here?

Best,
D.
Tagged:

Comments

  • Getting access to your clients server logs will really help.


    Not sure about your PHP, but one kink that might be getting you is that surveys can be set to allow only a single response. Make sure the survey allows multiple submissions, or your tests will fail. That should return an error though.


    Another option is to go with the API rather than a scraped survey form. http://open.convio.com


    Check out LuminateExtend on Github - a Luminate API helper library that will make this 1000x easier.


    BPM

Categories