Create Journals
Update Journals

Journals
Find Users
Random

Read
Search
Create New

Communities
Latest News
How to Use

Support
Privacy
T.O.S.

Legal
Username:
Password:

Using fpassthru()

Contributed by: Bill Humpries

This method simply opens the journal URL, and then prints the content.

Explanation

This method uses fopen() to open the journal URL, and then uses fpassthru() to pass the journal content to stdout.

<?php
$journalURL = "http://www.blurty.com/".
              "customview.cgi?username=username&styleid=101";
 
if ($fh = fopen($journalURL,"r"))  {
    fpassthru($fh);
} else {
    echo "<p>Unable to load journal.</p>\n";
}
?>

Using fsockopen()

Contributed by: Elliot Schlegelmilch

This method is slightly different, and may work even if URL fopen wrappers aren't enabled on your server.

Explanation

This method uses fsockopen() to open a network socket to the journal site, and then uses the HTTP protocol to request the journal's content. Given that it doesn't fail, it will simply fetch each line of the server's response.

<?php
$fp = fsockopen("www.blurty.com", 80, &$errno, &$errstr, 30);
if($fp) {
    fputs($fp,"GET /customview.cgi?".
              "username=username&styleid=101 HTTP/1.0\n\n");
    while(!feof($fp)) {
        echo fgets($fp,128);
    }
    fclose($fp);
}
?>

Using file()

Contributed by: Jay Cuthrell

This method is useful for those that want a line by line parse of their journal, with line number references.

Explanation

This method uses the file() function to read in the journal content as a large array, and then it prints it back out line by line.

<?php
$page = "http://www.blurty.com/customview.cgi".
        "?username=username&styleid=101";
$content = file($page);
$slurp = "";
while (list($foo,$bar) = each($content)) {
    $slurp .= $bar; 
}
echo $slurp; 
?>

Using include()

Contributed by: Jon Parise

This simply includes the journal page inside of the PHP page.

Note

This requires you have URL fopen wrappers enabled (they're on by default in PHP 4).

<?php
include "http://www.blurty.com/customview.cgi".
        "?username=username&styleid=101";
?>

*

<< Back to the embedding page

© 2002-2008. Blurty Journal. All rights reserved.