473,378 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 2085

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
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
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
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
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
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.