Page 1 of 1

Wants to get a text from source. (Text between 2 words)

Posted: Sun May 25, 2014 8:27 am
by zerandib
Hi,

I want to get a specific word from the source-code

relevant source code is like this;

Code: Select all

    <div class="container_16 marginTB10px">
    						<div id="wow_backtoalldeals">
    							<div id="gobacktoindex" class="grid_15 alpha omega">
    								Looking for the full list of deals?
    								<a href="/deals/home.jsp?atg.multisite.remap=false">Click here</a>	to go back
    							</div>
    							<div class="clear"></div>
    						</div>
    					</div>

    					<div class="clear"></div>

    	</div>
    				<!-- Deal item Block End -->
    			</div>
    			<div class="clear"></div>

    			<div id="addToCartInputs"></div>
    			<script type="text/javascript">

    				$(document).ready(function() {
    					var endDate = "2014-06-06 00:00:00.0";
    					var endDay = new Date(getTimestamp(endDate));
    					$('#countDownTime').countdown({
    						until : endDay,
    						format: 'dHM',
    						layout: '{dnn} Day(s) {hnn} Hour(s) {mnn} Minute(s)  Remaining',
    						expiryText: "Expired"
    					});

    				})
    			var attrNames = '';
    			var attrValues = '';
    			var productId = 'prod1010042';
    			var skuId = '';
    			var qty = '15';
    			function getSkuAttributes(attrName,selectedIndex) {

    				attrNames = '';
    				attrValues = '';
    				skuId = '';
    				$('select[id^=dealoptions]')
    						.each(
    								function(index) {
    									console.log(index + ": "
    											+ $(this).val() + ' '
    											+ $(this).attr('name'));
    									if (index <= selectedIndex) {
    									if (index == 0) {
    										attrNames += $(this).attr(
    												'name');
    										attrValues += $(this).val();
    									} else {
    										attrNames += '~'
    												+ $(this).attr(
    														'name');
    										attrValues += '~'
    												+ $(this).val();
    									}
    									}
    								});
    				callSkuContents();

    			}

From the above source code i want to get this 2014-06-06 00:00:00.0 part.

How can i do this?

I have done like this
-----------

$html2 = str_get_html($mysource);
$value = $html2->find(<<What needs to come here>>)

--------------

Looking forward for your responses

regards,
zerandib

Re: Wants to get a text from source. (Text between 2 words)

Posted: Sun May 25, 2014 9:57 pm
by Christopher
Do you want to find any text formatted like date? Or do you want to find the value of a variable named "endDate" in the source? Or maybe any variable with "Date" in the name?