1

Hello I have an array of data in the following format

http://pastebin.com/NeS4DaAn

The data contains address, phone numbers and some tags. There is a special Javascript value in the array within document.write, that when executed produce an email address. I want to save this data in a MySQL database using PHP, but with the actual email address not with the Javascript code and I am not able to figure out, how to do it ?

1
  • I'm assuming the pastebin represents HTML form data submitted to PHP. Can you post some information about the form itself, and about how it is generated? Parsing the string in PHP will work, but I think the real fix is to change whatever is putting Javascript code into a form input value, but we can't provide any pointers on that without this information. Commented May 30, 2013 at 14:47

1 Answer 1

1

UPDATED

Send JS to the server then do

 $decodedJS= html_entity_decode($myJS);

function extract_emails_from($string){
    preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
    return $matches[0];
}

$email = extract_emails_from($decodedJS);
Sign up to request clarification or add additional context in comments.

1 Comment

This worked great, here's the output pastebin.com/1D8TFcBY, Can you also tell me how can I extract the email addresses and other data from this multidimension array. The email is located at different indexed in the array :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.