{"id":474,"date":"2009-09-17T10:05:13","date_gmt":"2009-09-17T16:05:13","guid":{"rendered":"http:\/\/thepizzy.net\/blog\/?p=474"},"modified":"2014-01-24T14:40:07","modified_gmt":"2014-01-24T20:40:07","slug":"hamachi-web-status-images","status":"publish","type":"post","link":"https:\/\/thepizzy.net\/blog\/2009\/09\/hamachi-web-status-images\/","title":{"rendered":"Hamachi Web Status Images"},"content":{"rendered":"<h2>Update&#8230;<\/h2>\n<p>Unfortunately, LogMeIn figured out they forgot about that page, I guess when people started reading this post and hitting it on their servers. They have removed the text status as well as all the others, and I can&#8217;t figure out why they would do such a thing.<\/p>\n<p>I&#8217;m also not sure what they&#8217;re offering as an alternative either. So if you know, please leave a comment below. Thanks.<\/p>\n<h2>Depreciated Process&#8230;<\/h2>\n<p>A while back, I started a project called <a href=\"http:\/\/thepizzy.net\/blog\/?s=tsnlocal\">tsn.lcl or tsnlocal<\/a>, but gave up on it when my electricity bill hit $400 in a month.<\/p>\n<p>Today, I decided to fix up the domain name and get it back on the internet &#8211; at least to remove it from GoDaddy&#8217;s Parking Page &#8211; where they&#8217;re making money, not me, off of it.<\/p>\n<p>When I got it <a href=\"http:\/\/tsnlocal.net\" target=\"_blank\">published<\/a> I noticed that none of the Hamachi Web Status images worked anymore, and that the <a href=\"https:\/\/my.hamachi.cc\/status\/image.php?5.28.161.250\">link to such an image<\/a>, redirected to their login page for your Hamachi Management Dashboard. However, upon further investigation, I found that there was not only an Image version of those status instances, but also a <a href=\"https:\/\/my.hamachi.cc\/status\/text.php?5.28.161.250\">text version<\/a>.<\/p>\n<p>I really wanted to show the online status of all my machines again, so I wrote my own php script to parse that text data, and created some simple images to show on the website based on the returned status.<\/p>\n<p>So here&#8217;s the code so you can do the same thing&#8230;<\/p>\n<h2>The PHP Function<\/h2>\n<p>[cc lang=&#8221;php&#8221;]&lt;?php<br \/>\nfunction hamachiImg($ip) {<br \/>\n$url = &#8220;https:\/\/my.hamachi.cc\/status\/text.php?$ip&#8221;;<br \/>\n$status = file_get_contents($url);<br \/>\n$status = preg_replace(&#8216;\/\\d*\\.\\d*\\.\\d*.\\d* \/&#8217;, &#8221;, $status);<br \/>\n$image_url = &#8220;.\/images\/$status.png&#8221;;<br \/>\nreturn $image_url;<br \/>\n}<br \/>\n?&gt;[\/cc]<br \/>\nThis code creates a $url variable with the address to the text status, based on the $ip that is passed to it. Then it requests the data, removes the ip address and the trailing space, leaving only the status text. On the server, I have a collection of images with the 4 different statuses as their file name, and with that an $image_url is created to be returned.<\/p>\n<p>The 4 possible statuses are:<\/p>\n<ul>\n<li><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"hamachi-online\" alt=\"\" src=\"https:\/\/i0.wp.com\/tsnlocal.net\/images\/online.png?resize=16%2C17\" width=\"16\" height=\"17\" \/> &#8211; online<\/li>\n<li><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"hamachi-offline\" alt=\"\" src=\"https:\/\/i0.wp.com\/tsnlocal.net\/images\/offline.png?resize=16%2C17\" width=\"16\" height=\"17\" \/> &#8211; offline<\/li>\n<li><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"hamachi-unknown\" alt=\"\" src=\"https:\/\/i0.wp.com\/tsnlocal.net\/images\/unknown.png?resize=16%2C17\" width=\"16\" height=\"17\" \/> &#8211; unknown<\/li>\n<li><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone\" title=\"hamachi-error\" alt=\"\" src=\"https:\/\/i0.wp.com\/tsnlocal.net\/images\/error.png?resize=16%2C17\" width=\"16\" height=\"17\" \/> &#8211; error<\/li>\n<\/ul>\n<h2>The HTML Code and PHP Function Call<\/h2>\n<p>Once you have your php function in the page (I stuck mine before the first &lt;html&gt; tag), you can use the php function to insert the image url when you pass it an IP&#8230;<br \/>\n[cc lang=&#8221;html&#8221;]&lt;table&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td style=&#8221;width: 100%&#8221;&gt;[[Neo]]:&lt;\/td&gt;<br \/>\n&lt;td style=&#8221;width: 100%&#8221;&gt; &lt;img src=&#8221;&lt;?php echo hamachiImg(&#8216;5.37.117.104&#8217;); ?&gt;&#8221;&gt;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/table&gt;[\/cc]<br \/>\n<a href=\"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"477\" data-permalink=\"https:\/\/thepizzy.net\/blog\/2009\/09\/hamachi-web-status-images\/hamachi-example\/\" data-orig-file=\"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png?fit=210%2C201&amp;ssl=1\" data-orig-size=\"210,201\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"hamachi-example\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png?fit=210%2C201&amp;ssl=1\" class=\"alignright size-full wp-image-477\" title=\"hamachi-example\" alt=\"hamachi-example\" src=\"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png?resize=210%2C201\" width=\"210\" height=\"201\" srcset=\"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png?w=210&amp;ssl=1 210w, https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi-example.png?resize=150%2C143&amp;ssl=1 150w\" sizes=\"auto, (max-width: 210px) 100vw, 210px\" \/><\/a>Once you&#8217;ve done that, assuming you have entered a valid hamachi IP address, the results should look something like the image at right.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update&#8230; Unfortunately, LogMeIn figured out they forgot about that page, I guess when people started reading this post and hitting it on their servers. They have removed the text status as well as all the others, and I can&#8217;t figure out why they would do such a thing. I&#8217;m also not sure what they&#8217;re offering [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[506,25,11,3,8],"tags":[233,562,561,401,374],"class_list":["post-474","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","category-programming","category-projects","category-tech","category-tsnlocal-net","tag-hamachi","tag-images","tag-status","tag-vpn","tag-web"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/thepizzy.net\/blog\/wp-content\/uploads\/2009\/09\/hamachi1.jpg?fit=480%2C236&ssl=1","jetpack_likes_enabled":false,"jetpack_shortlink":"https:\/\/wp.me\/prOO4-7E","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/posts\/474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/comments?post=474"}],"version-history":[{"count":25,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/posts\/474\/revisions"}],"predecessor-version":[{"id":1504,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/posts\/474\/revisions\/1504"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/media\/628"}],"wp:attachment":[{"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/media?parent=474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/categories?post=474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thepizzy.net\/blog\/wp-json\/wp\/v2\/tags?post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}