3

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%" />';
0

3 Answers 3

8

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/

Sign up to request clarification or add additional context in comments.

2 Comments

echo '<iframe src="'.$row[$url].'" width="100%" />';
@Chris: Can we have your entire code with the <iframe>? Because it does work, that's what it's for. Also, I don't think <iframe> is self-closing, is it?
2

why don't you try with iframe ? Something like:

<td><iframe src='http://www.theothersite.com/list.php'></iframe></td>

otherwise you have some tags like html and body inside a td and this can be confusing for the browser. Also consider that your loaded page use the styles of the wrapper page

Hope this helps

Comments

0

Use an iframe, it is designed to do the thing you need.

Here's an example

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.