473,769 Members | 2,355 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 2107

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_conten ts
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.co mwrote:
>...This is typically referred to as "scraping" ...

see fopen ... file_get_conten ts ...


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************ **********@j72g 2000cwa.googleg roups.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_conten ts("http://www.qrz.com/detail/KB2GSD");
$name_pattern = '/Name:(.*)/';
preg_match($nam e_pattern, $file, $match);
echo strip_tags($mat ch[1]).'<br />';

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

$country_patter n = '/Country:(.*)/';
preg_match($cou ntry_pattern, $file, $match);
echo strip_tags($mat ch[1]).'<br />';

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

$grid_pattern = '/Grid:(.*)/';
preg_match($gri d_pattern, $file, $match);
echo strip_tags($mat ch[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
2392
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 name. The problem is that it takes 2+ minutes to generate the MD5 hash, so this function takes about 5 minutes every time it is called. Since the first MD5 hash is generated on a remote machine, the local machine does nothing but wait for...
7
1872
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 scrape textual content from places on the web using MSXML and assorted scracping widget. That doesn't help me for photos, nor does it answer how to encapsulate the photos in a form that I can see them. This would probably only find use in...
1
3024
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 welcome page has a browse button (for locating your local file), a textfield where the path is displayed, and a upload button. When clicking upload a VB ASP script is run, and the outcome is displayed on a new page. 1. On my local machine I got the...
21
4983
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
4016
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 http://oursite:8080/ and it returns
2
1826
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 either is patently impossible or I am not searching for the right thing. If either of these is the case, of course, please let me know. What I am trying to do is grab a little snippet of data from a remote page based on user input in a form....
2
2827
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 be viewable on remote machines, please create a <customErrorstag within a "web.config" configuration file located in the root directory of the current web application. This <customErrorstag should then have its "mode" attribute set to "Off". ...
3
4188
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 The asp page acts like it works, but no email comes through. I initially set the page up with CDONTS (as the tutorial explained): http://www.webthang.co.uk/Tuts/tuts_dmx/dmxf_5/dmx5_3.asp
5
3559
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 this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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
10050
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...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
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.