Forum Moderators: coopster

Message Too Old, No Replies

Absolute URL's in Server Side Includes

absolute url, ssi, server side include, php,

         

Zawzum

4:41 pm on Oct 16, 2008 (gmt 0)

10+ Year Member



I am new to php and am trying my darndest to figure something out. Is it possible to do a php include to a url outside of the domain that I have? I know the quick answer to that is yes, so long as I have the file extension (.htm, .txt, etc) but what about when trying to link to a dynamic page? I am fluent in CSS but PHP is a new trick for me and I am having a lot of trouble finding information on this.

The Code I used is here:

<?php 

$file= "http://www.example.com"; 

if($data = file_get_contents($file)){ 

echo $data; 

} else { 

echo "No data to echo"; 

} 

?>

I understand that the if statement is not absolutely necessary, but it seems to work, so I haven't messed with it...

An example of one of the dynamic links I am trying to include is:
http://www.example.com/ws/ws.dll/StartSrch?UID=83208&category=bags

Thank you for any assistance!

[edited by: eelixduppy at 4:46 pm (utc) on Oct. 16, 2008]
[edit reason] exemplified [/edit]

eelixduppy

4:47 pm on Oct 16, 2008 (gmt 0)



Hello and Welcome to WebmasterWorld! :)

Try changing the file variable:


$file = 'http://www.example.com/ws/ws.dll/StartSrch?UID=83208&category=bags';

you must have the allow_url_fopen directive enabled in your php.ini configuration file.