SOLVED

Re: Creating leads VIA PHP

Go to solution
Anonymous
Not applicable

Creating leads VIA PHP

Hello,

This is my first time really working with Marketo and I am running into a few issues. I have a custom PHP form that when submitted runs a quick AJAX call to post the data to a php form (using curl). On form submission this form should create a new lead in Marketo.

*Not posting form as it is very long.

example form fields.

<input type="text" name="fullName" required="required"/>

<input type="text" name="email" required="required"/>

<input type="text" name="jobTitle" required="required"/>

$("#mcontact").submit(function(event) {
  var ajaxRequest;
  /* Stop form from submitting normally */
  event.preventDefault();
  /* Get from elements values */
  var values = $(this).serialize();
  console.log(values);
  /* Send the data using post and put the results in a div */
  ajaxRequest= $.ajax({
      url: "/wp-content/themes/dynamic17/inc/marketo_sub.php",
      type: "post",
      data: values
  });
  /*  request cab be abort by ajaxRequest.abort() */
  ajaxRequest.done(function (response, textStatus, jqXHR){
    // show successfully for submit message
    $('.main-contact-header').hide();
    $('#mcontact').hide();
    $('.form_success').show();
  });
  /* On failure of request this function will be called  */
  ajaxRequest.fail(function (){
    // show error
    $("#result").html('There is error while submit');
  });
});

I am looking at the example for: http://developers.marketo.com/blog/add-salesperson-data-to-marketo/ on how to do the next step but am getting stuck. How can I pass the form data into marketo_sub.php so that Marketo can then read it and create a lead.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Creating leads VIA PHP

You don't need -- and shouldn't be using -- an intermediate server to insert leads into Marketo. You're creating a clear DoS vulnerability.

Forms, even 3rd-party custom forms, can insert data directly into Marketo using the Forms 2.0 API. If you search the Community you'll see many examples.

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Creating leads VIA PHP

You don't need -- and shouldn't be using -- an intermediate server to insert leads into Marketo. You're creating a clear DoS vulnerability.

Forms, even 3rd-party custom forms, can insert data directly into Marketo using the Forms 2.0 API. If you search the Community you'll see many examples.

Anonymous
Not applicable

Re: Creating leads VIA PHP

This is why I wanted to reach out. Knowing is half the battle. Are you referring to: Forms 2.0 - Raw Form Callback as to how this should be done?

SanfordWhiteman
Level 10 - Community Moderator

Re: Creating leads VIA PHP

Yep, that post is the right track.