Hi,

With PHP 7.3, the following was used to grab content from another website:

<?php include 'https://www.some-other-website.com/stuff.php';?>

It works in PHP 7.3, but I get a black page in PHP 7.4 or higher.

Any help would be appreciated.

Thanks,

Jim

Recommended Answers

All 2 Replies

Do this instead:

<?php echo file_get_contents('https://www.some-other-website.com/stuff.php'); ?>

or

<?php
    $output = file_get_contents('https://www.some-other-website.com/stuff.php');
    // ... Do something with the $output string that contains the HTML from stuff.php ...

include() is used when you need to include other local PHP libraries in your code. Those other PHP files get interpreted by PHP. Use file_get_contents() when you want to take whatever string is executed by PHP (HTML or otherwise) and spit it out.

Just following up. Did this work for you?

commented: Hi Dani - thansk so much for the follow up! Unfortunately neither worked. Did you have any other thoughts? Thanks Again! Jim +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.