Jump to content

Recommended Posts

I am very new to php so please be kind.

 

To put it simply:

I have an external url eg. http://www.externalurl.com/index.php?token=61DKJH1B&source=WR

 

What I want to be able to do is pull that page into my own url eg http://www.myurl.com/myphp.php?token=61DKJH1B&source=WR

 

So basically I need to display the external page and still be able to change the variable in the url to feed to the external page.

 

Essentially I just want to mask the original url but still feed it the token=61DKJH1B&source=WR.

 

Any ideas would be much appreciated?

 

 

Link to comment
https://forums.phpfreaks.com/topic/172092-loading-external-content/
Share on other sites

$contents = file_get_contents('http://www.externalurl.com/index.php?token=61DKJH1B&source=WR');
$contents = str_replace('http://www.externalurl.com/index.php', 'http://www.myurl.com/myphp.php?url=http://www.myurl.com/myphp.php', $contents);
print $contents;

Thanks so much for a quick and direct response.

 

This works great, apart from the fact that some of the elements from the page are unformatted or missing. Im guessing this is because it is trying to run files local to my url folder that obviously exist on the other site.

 

Is it possible to get the external content to run as if existing on its site?

 

Don't know if this is possible, but hey worth an ask.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.