On my site users complete a form that is connected to an off-site third party software. Once the user clicks the submit button they are forwarded to a second page on my site that displays a unique code generated by javascript from the third party software.

What I want to do is add this unique code to the Wordpress user's meta information. I think the best way to do it is the following (open to other suggestions):

  • Create a new user profile field ($unique_code)
  • Scrape or pull the unique code from the page
  • Identify the current user id
  • Input the unique code into the user profile

My challenges are:

  1. How do I scrape/pull the data from the page?
  2. How do I add the data to the user meta without a form or submit action?

Any suggestions or advice would be appreciated.


I do not think you need to scrape the page. Here is what I think you should do:

  1. Fill form details on page 1
  2. Submit the form on page 1
  3. Get forwarded to page 2
  4. A special unique code is generated by 3rd party software on form 2
  5. Submit this unique code to the server via AJAX
  6. Once the code is save, display it to the user

As you can see,

  1. You do not need to scrape, but rather read the code that is returned to you before displaying it
  2. You submit that code via AJAX, so no need to do a submit action

If you have to absolutely scrape (which I highly doubt), then you go ahead with that, but after you do, you still have to submit your code via AJAX.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.