Jump to content


send post data

  • Please log in to reply
3 replies to this topic

#1 reggler

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 September 2006 - 05:01 PM


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?
      //*********[POST to SF]***************
      // file: send_post.php
	  error_reporting(E_ALL & ~E_NOTICE);
	  $eol = "\r\n";
	  $errno = 0;
	  $errstr = '';
	  $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);
      //*********[/POST to SF]***************/

Thank you, every help is kindly appreciated!

#2 craygo

  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 07 September 2006 - 05:08 PM

where is your form. Can't get data from post without a form to post it.


#3 reggler

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 September 2006 - 05:13 PM

yeah, of course do data get posted to that script by:
<form name="Formular" method="post" onSubmit="return chkform()" action="<?php echo $PHP_SELF ?>">
              <td class="text"><font color='red'>*</font>First Name:</td>
              <td class="text"> <input type="text" name="firstname" class="flat"> </td>
              <td class="text"><font color='red'>*</font>Last Name:</td>
              <td class="text"> <input type="text" name="lastname" class="flat"> </td>
              <td class="text">Company:</td>
              <td class="text"> <input type="text" name="company" class="flat"> </td>
              <td class="text"><font color='red'>*</font>Email:</td>
              <td class="text"> <input type="text" name="email" class="flat"> </td>
              <td class="text"><font color='red'>*</font>Phone:</td>
              <td class="text"> <input type="text" name="phone" class="flat"> </td>
              <td class="text"><font color='red'>*</font>City:</td>
              <td class="text"> <input type="text" name="city" class="flat"> </td>
              <td class="text"><font color='red'>*</font>State/Province:</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>
              <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>
              <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>
                          <td width="36%" align="right" class="text"><font color="#ff0000">*</font>Comments/<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>
              <td class="text">Liquid Capital to Invest:</td>
              <td class="text"> <input type="text" size="20" name="capital" class="flat"> </td>
              <td class="text">Expected Timeframe:</td>
              <td class="text"> <input type="text" name="timeframe" class="flat"> </td>
              <td align="right" class="text"><input type="hidden" name="contact" value="1"><input type="submit" name="contactsubmit" value="Send" class="flat">

#4 reggler

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 September 2006 - 05:20 PM

and i don't know if it matters but it says, the html header must be:
 <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users