Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Embedding website into page

Tags:

php

embed

I want to call a website and embed it into a table cell. I have no problem getting the request for the site or the url from the database. But when I embed it, it jumbles it and puts it all over the place or doesn't open the entire page.

I have:

$remote = fopen("http://www.theothersite.com/list.php", "r");
fpassthru($remote);

Are there any other cleaner solutions?

iframe shows up blank: echo '<iframe src="'.$row[$url].'" width="100%" />';

        $url = 'URL';
        $tag = 'Tag';
        $id = 'P_Id';

        $query = "SELECT * FROM web_db WHERE Tag = '" . $userTag . "' ORDER BY RAND() LIMIT 1";

        $result = mysql_query($query);
        if($result) 
        {
            while($row = mysql_fetch_array($result))
           {
              echo 'ID:' . $row[$id] . '<br>';
              echo 'URL: ' . $row[$url] . '<br>';
              echo 'Tag:' . $row[$tag] . '<p>';


        //    $remote = fopen($row[$url],"r");
        //    fpassthru($remote);

            echo '<iframe src="'.$row[$url].'" width="100%" />';
like image 270
Chris Avatar asked Dec 06 '25 10:12

Chris


1 Answers

what prevents you from trying a HTML solution ?

Put an iframe inside the table with src equal to the website URL . If you do not have to pre-process the data of the other site, or do not need to hide the other site url, then iframe is a good solution. See example : http://jsfiddle.net/c43zH/

like image 75
DhruvPathak Avatar answered Dec 07 '25 23:12

DhruvPathak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!