By bomarmonk on
I have been trying to wrap a catalog search page on a different server within a Drupal node. I've tried using PHP in a node to attempt this:
$site = 'http://www.wrappedsite.com';
print $site;
or
$site = fopen ("http://fake.IP.14.169/", "r");
print $site;
Neither of these attempts worked. I'm sure I can do something like this. Any ideas, suggestions, or code would be greatly appreciated! Thanks again for any help!
Comments
I might be wrong but what
I might be wrong but what your trying to do isnt going to work at all, if only every thing in life was that simple
you'd better google "+web+fetching"+PHP
there are loads of scripts out there that will do that kind of thing for you
some even store the data in a database that can be then called from within your drupal site.
I have a code snippet
I have a code snippet that will work, I tried posting it, but Drupal's filter does not allow it saying suspicious input.
Contact me at the sites below and I will email it to you.
--
Consulting: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
Here
Here is my content wrapping code snippet.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
Easy
--
Read my developer blog on Drupal4hu.
--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.
It needs more work
All the snippets provided need to do other things
For example, img and relative href tags must be rewritten to put the appropriate absolute path so it would work.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
Well, it does part of the job
Thanks for the help, but I need something a bit more robust. The page I'm trying to frame into Drupal is a library catalog that runs on its own database and off of its own server. While the aforementioned scripts pull up the basic html, images are not rendered. Also, the data entered into a search is not passed back to library catalog's server. I guess my problem is a bit more complex... darn it.
PCRE
Read up on PCRE (Perl Compatible Regular Expressions) on php.net, and then substitute the img src you read with $base_url of your own site.
You need to do the same for the form, it has to point to their server not yours.
Yes, it is more complex that it looks initially ...
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
any success yet?
I'm very interested in this and I wondered if anyone has gotten it to work yet--I tried several options posted here and the css of the imported page seems to get mixed with my theme's css. Otherwise it worked ok but I can't use it because of the css thing.
No luck yet
This isn't high on my list of priorities, but it would be great if someone could share a successful bit of code that allows an external database/web interface to run within a node. Mambo does this with an i-frame, so it may not be that tricky
Iframe works
I would reproduce the code here, but it is detected as suspicious. But simply using an i-frame with the IP address of the server will get this to work. Don't wrap the iframe in any kind of php open or close tags (that was my mistake).
Wrap content from another site
Maybe others already know this, but I looked here trying to find out how to do this too, and finally came across this that works very well. I thought I'd post it in case anyone else is looking, because I couldn't find it on this site.
<iframe src="http://page-to-be-wrapped" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>Just create a Page with the above HTML code and link to it. Change the parameters as needed.
bookmarking!!
bookmarking!!
---~~~***~~~---
aac