Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Taking text from a PHP file into an HTML file?

Featured Replies

Hey,

 

I've got a PHP file that outputs text, it shows how many people are watching a video, for example, "3286".

 

Example: http://mylzh.net/stream/viewers.php?stream=kungentv

Example 2: http://mylzh.net/stream/viewers.php?stream=tsm_theoddone

 

It keeps changing.

I have another PHP file that displays an image to show if that video is online or offline.

 

For example: http://mylzh.net/stream/stream.php?stream=tsm_theoddone (Green if online, Red if offline)

 

I can take that image from that file into the HTML easily with <img src="http://mylzh.net/stream/stream.php?stream=tsm_theoddone"> but how could I get the text into the HTML file?

 

Thanks,

 

- Luke

  • Author

If you are a developer in http://mylzh.net you can display that value using php.

 

Sure, the code is:

<?php
$stream = $_GET['stream'];
$streamData = json_decode(file_get_contents("http://api.justin.tv/api/stream/summary.json?channel={$stream}"),true);
$viewers = $streamData['viewers_count'];
echo $viewers;
?>

Edited by LukeeeeBennett

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.