Hi guys,

I really need your help, I have scraping the data from a website that i use to read the information on my php. I have a problem, I could not be able to scraping the right data from 5 hours backward of my current time, e.g my current time is 10pm and the 5 hours backward time is 5pm so i want to scrape the data that is on the same row as the 5pm time.

here is the php code:

[PHP] <?php

$data = file_get_contents('http://tvlistings.zap2it.com/tvlistings/ZCSGrid.do?stnNum=10179');
preg_match_all('/<a id="rowTitle\d+" class="zc-ssl-pg-title"[^>]*>([^<]+)<\/a>/im', $data, $matches);
$titles = $matches[1];

echo $titles[19]; [/PHP]

I can only scraping the data that are 7 hours backward from my current time, but i can't be able to figure it out how i can scraping the data that are 5 hours backward from my current time.

If you know how i can scraping the data in the same row as the time that are 5 hours backward from my current time, i would be very appreicated it if you could post the code that i can scraping the data that are 5 hours backward from my current time to the end of the page.

Any advice would be much appreicated.

Thanks in advance

Member Avatar for LastMitch

I can only scraping the data that are 7 hours backward from my current time, but i can't be able to figure it out how i can scraping the data that are 5 hours backward from my current time.

Is this on your database? Your question doesn't make any sense.

If you know how i can scraping the data in the same row as the time that are 5 hours backward from my current time, i would be very appreicated it if you could post the code that i can scraping the data that are 5 hours backward from my current time to the end of the page.

This is the first time I heard scrape data from a time frame of 5 hours.

I mean you can remove string data in the database and maybe I can understand but a time frame 5 hours?

Where is those data store?

How does those character look like?

No, I am using a tv guide website to scraping the data to output them to my php, I am not using a database.

What I am trying to say is i want to scraping the data 5 hours behind my current time, because the tv guide website is come from usa.

Here is what those look like:

11:00 PM SportsCenter LIVE

12:00 AM SportsCenter LIVE

1:00 AM SportsCenter LIVE

2:00 AM SportsCenter LIVE

3:00 AM MLB Baseball "Philadelphia Phillies at Cincinnati Reds"

My current time is 4:00pm and I want to scrape the data that is in the same row as 11:00pm. If my current time is 5:00am, I want to scrape the data in the same row as 12:00am. The same things goes for each row and data.

I hope you get my point what I am trying to say?

Member Avatar for LastMitch

What I am trying to say is i want to scraping the data 5 hours behind my current time, because the tv guide website is come from usa.

Those are words not scrape. Scrape means unwanted/weird characters.

You trying to remove dupilcutle sentences from your website.

I assume you are using XML sheet to store the data (to me it's seems to look like that unless you used some other format)?

I hope you get my point what I am trying to say?

You can used something this (PHP Simple HTML DOM Parser):

http://simplehtmldom.sourceforge.net/

You can also read and used these examples (it's a tutorial):

http://www.phpbuilder.com/columns/PHP_HTML_DOM_parser/PHPHTMLDOMParser.cc_09-07-2011.php3

http://www.php4every1.com/tutorials/php-domdocument-tutorial/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.