php - Using DOMDOCUMENT to pull JavaScript values -


Is it possible to use the DOM document to drag javascript values?

  & lt; Script type = "text / javascript" & gt; Var datePickerDate = "14 October 2014"; $ (Document) .ready (function () {// Meetings datepicker $ ("# datepicker") Datepicker ({showOn: 'button', button image: '/images/calendar.gif', button image only: true , Select: function (date text, insta) {populate_meetings (dateText, 0)}, date format: 'mmm yy', minedet: new date (200 9, 0, 1), maximum date: 0}); $ '(' # Datepicker ').' Options', 'Default Date', New Date ("14 October 2014"); $ ('# Date Picker') Val ("14th October, 2014");}); // Call on page load to get meetings and date populated_times ("14th October, 2014", 15515); & Lt; / Script & gt;  

This is output in HTML, so I know this ... and I want to read the date so that var datePickerDate = drag, so it returns on October 14, 2014

- A little more explanation ---

Using domdocument to scrap a site and backing up html so

  $ html = file_get_contents ( $ Url); // Set the main page HTML code that will be converted to $ dom = new DOMDocument (resume); // load html @ $ dom- & gt; Load HTML ($ html); There is some javascript in HTML which has a date in it .... I would like to capture that date and paste it into a user  

Just populate a dropdown box with date populating the dates.

You can not use javascript (explicitly), so js variable with best expression The best thing to catch here can be Here's an example of using DOMXPath:

  # Create a new XPath object that you have $ xp = new DOMXPath ($ dom) in your code; # Page $ script = $ xp- & gt; Find all script elements in the query ("// script"); (# $, $ Script as $) {# See if the content of the script node has any match for var datePickerDate (preg_match ('# var datePickerDate =' (. *?) "# ', $ S -> NodeValue, $ matches) {# Capture in the bracket itself (date = 1) Print_A ($ matches [1]);}}  

Output:

  14 October 2014  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -