Jump to content

Archived

This topic is now archived and is closed to further replies.

reggler

send post data

Recommended Posts

Hi,

I'm trying to send some post data to another script but it somehow just wouldn't work but i do not get an error from the script, is there something wrong with my code?
[code]
      //*********[POST to SF]***************
      // file: send_post.php
  error_reporting(E_ALL & ~E_NOTICE);
  $eol = "\r\n";
  $errno = 0;
  $errstr = '';
  'debug=1&debugEmail=xxx@example.xyz&oid=00D300000000RpC&retURL=""&first_name='.$_POST['firstname'].'&last_name='.$_POST['lastname'].'&company='.$_POST['company'].'&email='.$_POST['email'].'&phone='.$_POST['phone'].'&city='.$_POST['city'].'&state='.$_POST['state'].'&country='.$_POST['country'].'&00N30000000h5O9='.$_POST['besttime'].'&00N30000000gxzU='.$_POST['comments'].'&00N30000000h5OG='.$_POST['capital'].'&00N30000000h5OE='.$_POST['timeframe'];
  $fid = fsockopen('http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8', 80, &$errno, &$errstr, 30);
  if ($fid)
  {
  fputs ($fid, "POST /post/show_post.php HTTP/1.1$eol");
  fputs ($fid, "HOST: localhost$eol");
  fputs ($fid, "Connection: close$eol");
  fputs ($fid, "Content-Type: application/x-www-form-urlencoded$eol");

  /* Use 'Content-Length' NOT 'Length' !*/
  fputs ($fid, 'Content-Length: ' . strlen($data) . $eol);
  fputs ($fid, $eol);
  fputs ($fid, $data);
  fputs ($fid, $eol);
  fpassthru($fid);
  }
      //*********[/POST to SF]***************/
[/code]

Thank you, every help is kindly appreciated!

Share this post


Link to post
Share on other sites
where is your form. Can't get data from post without a form to post it.

Ray

Share this post


Link to post
Share on other sites
yeah, of course do data get posted to that script by:
[code]
<form name="Formular" method="post" onSubmit="return chkform()" action="<?php echo $PHP_SELF ?>">
          <table>
            <tr>
              <td class="text"><font color='red'>*</font>First Name:</td>
              <td class="text"> <input type="text" name="firstname" class="flat"> </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>Last Name:</td>
              <td class="text"> <input type="text" name="lastname" class="flat"> </td>
            </tr>
            <tr>
              <td class="text">Company:</td>
              <td class="text"> <input type="text" name="company" class="flat"> </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>Email:</td>
              <td class="text"> <input type="text" name="email" class="flat"> </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>Phone:</td>
              <td class="text"> <input type="text" name="phone" class="flat"> </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>City:</td>
              <td class="text"> <input type="text" name="city" class="flat"> </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>State/Province:</td>
              <td>
                <span class="text">
                <select name="state" size="1" class="flat">
                  <option value="" selected>SELECT ONE</option>
                  <option value="AL">AL</option>
                  <option value="AK">AK</option>
                  <option value="AS">AS</option>
                  <option value="AZ">AZ</option>
                  <option value="AR">AR</option>
                  <option value="CA">CA</option>
                  <option value="CO">CO</option>
                  <option value="CT">CT</option>
                  <option value="DE">DE</option>
                  <option value="DC">DC</option>
                  <option value="FM">FM</option>
                  <option value="FL">FL</option>
                  <option value="GA">GA</option>
                  <option value="GU">GU</option>
                  <option value="HI">HI</option>
                  <option value="ID">ID</option>
                  <option value="IL">IL</option>
                  <option value="IN">IN</option>
                  <option value="IA">IA</option>
                  <option value="KS">KS</option>
                  <option value="KY">KY</option>
                  <option value="LA">LA</option>
                  <option value="ME">ME</option>
                  <option value="MH">MH</option>
                  <option value="MD">MD</option>
                  <option value="MA">MA</option>
                  <option value="MI">MI</option>
                  <option value="MN">MN</option>
                  <option value="MS">MS</option>
                  <option value="MO">MO</option>
                  <option value="MT">MT</option>
                  <option value="NE">NE</option>
                  <option value="NV">NV</option>
                  <option value="NH">NH</option>
                  <option value="NJ">NJ</option>
                  <option value="NM">NM</option>
                  <option value="NY">NY</option>
                  <option value="NC">NC</option>
                  <option value="ND">ND</option>
                  <option value="MP">MP</option>
                  <option value="OH">OH</option>
                  <option value="OK">OK</option>
                  <option value="OR">OR</option>
                  <option value="PW">PW</option>
                  <option value="PA">PA</option>
                  <option value="PR">PR</option>
                  <option value="RI">RI</option>
                  <option value="SC">SC</option>
                  <option value="SD">SD</option>
                  <option value="TN">TN</option>
                  <option value="TX">TX</option>
                  <option value="UT">UT</option>
                  <option value="VT">VT</option>
                  <option value="VI">VI</option>
                  <option value="VA">VA</option>
                  <option value="WA">WA</option>
                  <option value="WV">WV</option>
                  <option value="WI">WI</option>
                  <option value="WY">WY</option>
                  <option value="--">---</option>
                  <option value="AB">AB</option>
                  <option value="BC">BC</option>
                  <option value="MB">MB</option>
                  <option value="NB">NB</option>
                  <option value="NL">NL</option>
                  <option value="NT">NT</option>
                  <option value="NS">NS</option>
                  <option value="NU">NU</option>
                  <option value="ON">ON</option>
                  <option value="PE">PE</option>
                  <option value="QC">QC</option>
                  <option value="SK">SK</option>
                  <option value="YT">YT</option>
                </select>
                </span>
                </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>Country:</td>
              <td><span class="text">
                <select name="country" size="1" class="flat">
                  <option value="" selected>SELECT ONE</option>
                  <option value="US">United States</option>
                  <option value="CA">Canada</option>
                  <option value="Other">Other</option>
                </select>
                </span>
                </td>
            </tr>
            <tr>
              <td class="text"><font color='red'>*</font>Best time to call:</td>
              <td><span class="text">
                <select name="besttime" size="1" class="flat">
                  <option value="" selected>SELECT ONE</option>
                  <option value="9am to 12pm PST">9am to 12pm PST</option>
                  <option value="12pm to 3pm PST">12pm to 3pm PST</option>
                  <option value="Other">Other</option>
                  </select>
                  </span>
              </td>
            </tr>
                        <tr>
                          <td width="36%" align="right" class="text"><font color="#ff0000">*</font>Comments/<br>
                            Questions:<br>
                            <br>
                            chars left: <span id="charsleft"></span></td>

                    <td valign="top" width="64%" class="text"><textarea name="comments"
                        onKeyUp="count(event)" rows="8" cols="40" class="flat"></textarea></td>
                        </tr>
            <tr>
              <td class="text">Liquid Capital to Invest:</td>
              <td class="text"> <input type="text" size="20" name="capital" class="flat"> </td>
            </tr>
            <tr>
              <td class="text">Expected Timeframe:</td>
              <td class="text"> <input type="text" name="timeframe" class="flat"> </td>
            </tr>
            <tr>
              <td></td>
              <td align="right" class="text"><input type="hidden" name="contact" value="1"><input type="submit" name="contactsubmit" value="Send" class="flat">
              </td>
            </tr>
          </table>
        </form>
[/code]

Share this post


Link to post
Share on other sites
and i don't know if it matters but it says, the html header must be:
[code]
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.