473,513 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web clipping of a "remote" web page for insertion into a "local" page: is it possible?

What I am trying to do is grab a little snippet of data from a remote
page based on user input in a form. Take a look at this page:
http://www.qrz.com/kb2gsd

What I want to do is: when a user types the call sign (in this case,
KB2GSD) into a form field, I want to execute an XPath query (or somehow
otherwise process the contents of the page)
to automatically complete the Name, Location, etc. fields in my "local"
page from a "remote" web
page like the one listed above.

Is this possible with PHP? If so, what functions, libraries, etc. do I
need to read about in order to do this? I have searched a good deal for
examples/previously asked questions about this, but with little
success. What search terms might I use to find out a bit more about
this?

Thanks for reading and thanks for a response if you're able to help.

Dec 12 '06 #1
4 2091

soren625 wrote:
What I am trying to do is grab a little snippet of data from a remote
page.....
This is typically referred to as "scraping"

see fopen or even file_get_contents
http://us3.php.net/manual/en/function.fopen.php
These functions will open a webpage just like a local file
Then you can do whatever.
see the string functions
http://us3.php.net/manual/en/ref.strings.php
or regular expression funcs
http://us3.php.net/manual/en/ref.pcre.php

Dec 12 '06 #2


On Dec 12, 10:58 am, "BKDotCom" <bkfake-goo...@yahoo.comwrote:
>...This is typically referred to as "scraping" ...

see fopen ... file_get_contents ...


Awesome ... yeah, I guess that is scraping ... that term had not come
to mind for some reason.

Thanks a million for the help.

Dec 12 '06 #3
Message-ID: <11**********************@j72g2000cwa.googlegroups .comfrom
BKDotCom contained the following:
>These functions will open a webpage just like a local file
Doesn't seem to work with this particular site unless I'm doing
something wrong

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Dec 12 '06 #4


On Dec 12, 11:17 am, Geoff Berrow <blthe...@ckdog.co.ukwrote:
>Doesn't seem to work with this particular site unless I'm doing
something wrong
I got it to work exactly as I needed:

--------- START OF PHP CODE ----------------------

$file = file_get_contents("http://www.qrz.com/detail/KB2GSD");
$name_pattern = '/Name:(.*)/';
preg_match($name_pattern, $file, $match);
echo strip_tags($match[1]).'<br />';

$city_pattern = '/Addr2:(.*),/';
preg_match($city_pattern, $file, $match);
echo strip_tags($match[1]).'<br />';

$country_pattern = '/Country:(.*)/';
preg_match($country_pattern, $file, $match);
echo strip_tags($match[1]).'<br />';

$state_pattern = '/State:(.*)/';
preg_match($state_pattern, $file, $match);
echo strip_tags($match[1]).'<br />';

$grid_pattern = '/Grid:(.*)/';
preg_match($grid_pattern, $file, $match);
echo strip_tags($match[1]).'<br />';

------------------ END OF PHP CODE -------------

Works like a charm! Thanks again!

Dec 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2369
by: Kamus of Kadizhar | last post by:
I have the following function which generates MD5 hashes for files on a local and remote server. The remote server has a little applet that runs from inetd and generates an MD5 hash given the file...
7
1858
by: Ken Fine | last post by:
My well-heeled clients would like a tool that I could build into a web application that would suck down the entire contents a remote webpage and store it on a local filesystem. I know how to...
1
3009
by: PeterB | last post by:
Hi! I'm using Pure ASP File Upload (http://www.asp101.com/articles/jacob/scriptupload.asp) to upload a file from a client to a server. I am testing both on a local IIS and a remote server. The...
21
4940
by: nicholas | last post by:
Although in my web.config I have <customErrors mode="off" /> I still get no detailed errors. How comes ? THX This is what I get: Server Error in '/mywebfolder'Application.
9
4003
by: larrybud2002 | last post by:
I've read about this error in this group and others from early 2006 but without any resolution, so I thought I'd bump it up to see if there's a solution. Trying to build a website on ...
2
1803
by: soren625 | last post by:
I have searched this (and other) groups extensively, in addition to the clj FAQ and the Web, and (to my surprise) this question doesn't come up as often as I thought it would. Maybe this is because...
2
2790
by: Beemer Biker | last post by:
I made the above change to my web.config file so that errors would be reported from a remote site as explained in the Server Error: Details: To enable the details of this specific error message to...
3
4182
simpleton
by: simpleton | last post by:
Hey all, I'm new to this board. I'm trying to send email via a "contact us" form .asp page. I've setup SMTP Virtual Server on my local XP IIS 5.1 machine. I told it to relay with 127.0.0.1 ...
5
3530
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
0
7260
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,...
0
7162
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7539
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...
0
7527
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5090
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
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...
0
3223
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1597
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 ...
1
803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.