473,809 Members | 2,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pull part of an external webpage into another

3 New Member
Hi! This is my first post...and when I begin working on this project, it will also be my first PHP project! I do have some programming experience from my first year at college, but that was in Scheme :-). I have not started work on this problem yet, because I am still doing research and figuring out how I can do it using PHP. My goal is to turn this into a Joomla module that I can offer for free on Joomla.org and use on a few of the websites I create. So here is the overview of the problem: at this location [HTML]http://apps.cbp.gov/bwt/index.asp[/HTML] there is a website that has all of the border wait times for the US for both Canadian and Mexican ports of entry. In particular, I am interested in the Calexico ports, but I am sure I can generalize the problem enough to allow any of the other ports to be chosen as well. I want to use PHP to save a local copy of the page on the server, or alternately, to grab the page, parse it for the parts that are needed, and only cache that portion on the webpage (the cache or local copy would have to expire after only a few minutes, but that would at least minimize redundant calls for every page reload on my site, I figure). I know that cURL or fopen (I have both working on my server) allow you to grab external webpages, but I don't really know what I would need to do from there. How do I parse the page to only keep what I need? How can I set PHP to only run the function every couple of minutes, rather than every time the page loads? Those are my main questions, so if anybody could help point me in the right direction to some functions or webpages I could use they would be much appreciated :-).

-Omar
Oct 28 '06 #1
4 4678
ronverdonk
4,258 Recognized Expert Specialist
Many government orgs offer rss feeds (xml) that you can tap into. Are you sure that this cannot be done via an rss feed from that organization?

Ronald :cool:
Oct 28 '06 #2
orware
3 New Member
Thanks for the idea! Not that I would have any idea about what to do with the feed, but because of the XML I'm sure it would have been easier to parse through. I went to see the main area of the site, and checked out the RSS feeds, but the ones available are not related to the border wait times. Also, the page I referred to in my last post is on a subdomain...app s.cbp.gov, and they only have one other script (one for airport wait times), but no feeds that go along with them.

As I continued my research I read an article about output buffering that should prove helpful, however I still do not know how to parse a page to extract the data that I need. Again, any helpful functions you can mention would lower my search time reading up on php.net :-).

-Omar
Oct 28 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
If you'd have an RSS feed, you could tap into it and extract the info (xml structured) into a buffer and parse for info that you are looking for. For now, you'll have to 'scrape' a web page. Have a look at the following free php class at Scraper class that provides scraper functions.

Its description states:
This class is meant to fetch remote HTML pages and parse them to extract structured information into arrays.

It can take a model of the definition of the structure of a given page and process it to clip the relevant fields of information.
Ronald :cool:
Oct 28 '06 #4
orware
3 New Member
Nice...I'll take a look at it and I'll post back :-).

Thank you!

-Omar Ramos
Oct 29 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2555
by: Richard Speiss | last post by:
I am trying to display a random background image for a webpage. I found this code to do it <% 'Defines the number of background images you have Const NUMBER_OF_IMAGES = 2 'Initiates the randomize function Randomize
5
4781
by: Glenn Mulno | last post by:
Hi, I am trying to create a report page for several teams. Each team runs the same reports but the reports use different values. For a while this was getting insane everytime I updated the queries I had to change them in many places. Then I started using server side includes to keep me from changing some items in multiple places. There is still some double (quadruple) updating going on though when I make
5
2056
by: bobbyd | last post by:
Hi All, Does anyone know of a way to read an output from an external webpage/service? For example; The external source is on http://serverA:6010/sendoutput This page displays one line of outputted text, I want to be able to read this in an asp page into a variable.
1
3457
by: Daniel Di Vita | last post by:
I have an application that needs to pull files from an internal server. This is the setup. The web server is external facing, meaning exposed to the internet. I then have a file server that sits inside our domain. I created a COM object that can impersonate a user to retrieve files from that server. However, I cannot get the application to pull files from the internal server. I first tried a domain account that could reach both servers....
4
3932
by: Giorgio | last post by:
hi, how can i include a webpage from another server with ASP? (Without frames) i tried XMLHTTP, but i loose the stylesheet, images src and relative links of the included page. See http://www.punticardinali.it/1winhttp.asp ("222" is a text in the calling page, other staff is included) Ty
38
4038
by: Neo Geshel | last post by:
I am seeking a method to load one JS file directly into another, *without* having to dynamically write <scripttags. Is there any method whereby I can call only one external JS file using a single <scripttag, but have that external JS file insert into ITSELF the contents of five others? Something like: /*start external.js*/
7
4181
by: Andrea | last post by:
Hi there! I have to do a php script that daily surf a webpage (I do it with crontab) and collect some data. The proble is that to access that webpage I have to do a login. I have the login data, but do it via browser....ok, I'm not stupid, but do that via php script...well I'm not able to do it. The script is running on the server side, so it's useless to do the login on my browser prior to run the script. The page where I have to login...
5
1862
by: Yarda | last post by:
Hello, I am new to php and databases, we have an intranet and I have installed apache, mysql and php. We want to index, catalog and serve mp3 files from a web page using the above mentioned software. Could I be directed to tutorials that would explain how this is done. Thanks, Yarda
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.