{"id":55419,"date":"2022-04-14T03:01:01","date_gmt":"2022-04-13T17:01:01","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55419"},"modified":"2022-04-13T11:24:12","modified_gmt":"2022-04-13T01:24:12","slug":"php-passthru-document-title-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-passthru-document-title-primer-tutorial\/","title":{"rendered":"PHP passthru Document Title Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP passthru Document Title Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.jpg\" title=\"PHP passthru Document Title Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP passthru Document Title Primer Tutorial<\/p><\/div>\n<p>We are a bit in awe of the PHP <a target=_blank title='PHP passthru information' href='https:\/\/www.php.net\/manual\/en\/function.passthru.php'>&#8220;passthru&#8221;<\/a> function <font size=1>(again, &#8220;you had to be there&#8221;)<\/font> as that direct conduit to output from an underlying operating system command.   We&#8217;ve been in such awe, we have only ever dared use it on its own on a PHP codeline.  But yesterday&#8217;s <a target=_blank title='Xcode Command Line Project GUI Executable Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-command-line-project-gui-executable-tutorial\/'>Xcode Command Line Project GUI Executable Tutorial<\/a> got us wondering if we could tweak improvements, so that we can improve on &#8230;<\/p>\n<ul>\n<li>a &#8220;passthru&#8221; inspired webpage content just containing that <i>underlying operating system command content<\/i> &#8230; but which misses out on defining a webpage &#8220;document.title&#8221; which is shown (usefully in a web browser tabbing situation) on that webpage&#8217;s web browser tab of use &#8230; but what if we can have &#8230;<\/li>\n<li>a &#8220;passthru&#8221; inspired webpage content displays that <i>underlying operating system command content<\/i> while also establishing a relevant and useful &#8220;document.title&#8221; to display on that webpage&#8217;s web browser tab of use<\/li>\n<\/ul>\n<p>?  Happily, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.jpg\" title=\"Tutorial picture\">yet it being a tad awkward and kludgy<\/a>, it&#8217;s possible, and we wrote a PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.php_GETME\" title=\"passthru_test.php\">&#8220;proof of concept&#8221; passthru_test.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.php\">web application with a defined document.title<\/a> (versus <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/passthru_test.php?justpassthru=yes\">web application without a defined document.title<\/a>) source &#8230;<\/p>\n<p><code><br \/>\n&lt;?php<br \/>\n\/\/ passthru_test.php<br \/>\n\/\/ RJM Programming<br \/>\n\/\/ April, 2022<br \/>\n if (isset($_GET['justpassthru'])) {<br \/>\n   passthru('echo \"PHP passthru content with no HTML embellishment\"');<br \/>\n } else {<br \/>\n   echo \"&lt;html&gt;&lt;head&gt;&lt;title&gt;PHP passthru content has HTML document.title embellishment&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;pre&gt;\" . passthru('echo \"PHP passthru content has HTML document.title embellishment\"') . \"&lt;\/pre&gt;&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n }<br \/>\n exit;<br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; can have us improving yesterday&#8217;s PHP code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/find_executable_and_go.php\">find_executable_and_go.php web application<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/find_executable_and_go.php--GETME\" title=\"find_executable_and_go.php\">mildly changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/find_executable_and_go.php--GETME\" title=\"find_executable_and_go.php\">find_executable_and_go.php<\/a> which we, yet again, want you to download to (the Document Root of) a macOS <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server environment, &#8220;Intranet style&#8221;.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55419' onclick='var dv=document.getElementById(\"d55419\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/passthru\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55419' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We are a bit in awe of the PHP &#8220;passthru&#8221; function (again, &#8220;you had to be there&#8221;) as that direct conduit to output from an underlying operating system command. We&#8217;ve been in such awe, we have only ever dared use &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-passthru-document-title-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,29,37],"tags":[1816,885,2427,932,997,2001,1319,1404,1418],"class_list":["post-55419","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-document-title","tag-operating-system-2","tag-passthru","tag-php","tag-programming","tag-tab","tag-tutorial","tag-web-browser","tag-webpage"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55419"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=55419"}],"version-history":[{"count":10,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55419\/revisions"}],"predecessor-version":[{"id":55429,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55419\/revisions\/55429"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}