Greetings! I have heard of various methods to capture and return text. For example regular expressions. I am slightly new to PHP but I was wondering how I would capture and return text from this JavaScript code using PHP. I am only interested in capturing msgBody, msgTitle, and insertDate. Thank you for looking my my problem
function wibiyaNotifierLoad() {
if (typeof(jQuery.cookie) == 'function') {
loadjscssfile("Graphics_Toolbar/Notifier/notifier_2.css?v2", "css", "head");
var data = {
"count": 1,
"notifications": [{
"Id": "264727",
"toolbarId": "602582",
"msgId": "9",
"msgTitle": "Its that time of year!",
"msgBody": "check you email for updates!",
"msgLink": "",
"msgImage": "",
"filter": "",
"startDate": "2011-03-22 23:00:00",
"expirationDate": "2011-03-23 00:00:00",
"active": "1",
"insertDate": "2011-03-22 23:12:31"
}],
"ok": true
};
When you say parsing, you should look into J4P5. But you can probably get away with an inexact solution and regular expressions here. To capture the text and then extract individual values:
Could make the regex more explicit by starting it with
'#"notifications": (\[\{however.