Title: Adding php script
Last modified: August 19, 2016

---

# Adding php script

 *  [ubailey79](https://wordpress.org/support/users/ubailey79/)
 * (@ubailey79)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/)
 * I have tried several ways of adding the following code below to my pages but 
   have not been able to get the page to display correctly. I have tried various
   php plugins like exec-php, php exec and many others to no avail. Can anyone give
   me any insight on what I am doing wrong with the code below. I am basically placing
   the code inside a new page or post, but when i click to display, it shows the
   code instead of the store which is what the code is for?
 * <?php
    $SID=”02486A4A-7C45-4014-825D-B0789249A909″; $IPAddress = urlencode($_SERVER[‘
   REMOTE_ADDR’]); $UserAgent = urlencode($_SERVER[‘HTTP_USER_AGENT’]); $Host=urlencode(
   $_SERVER[‘HTTP_HOST’]); $PageURL=urlencode($_SERVER[‘SCRIPT_NAME’].’?’.$_SERVER[‘
   QUERY_STRING’]); $URL=”[http://si.goldencan.com/GetData.aspx?ver=2.0&SID=&#8221](http://si.goldencan.com/GetData.aspx?ver=2.0&SID=&#8221);.
   $SID; $URL=$URL.’&Host=’.$Host; $URL = $URL.’&PageURL=’.$PageURL; $URL = $URL.’&
   IPAddress=’.$IPAddress; $URL = $URL.’&UserAgent=’.$UserAgent; include($URL); ?
   >

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * (@doodlebee)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/#post-1861545)
 * You can’t place PHP code within a post without a plugin. You either need to obtain
   a plugin that allows PHP to run from within a post, or write a function and apply
   the function to the template file.
 *  Thread Starter [ubailey79](https://wordpress.org/support/users/ubailey79/)
 * (@ubailey79)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/#post-1861554)
 * I have tried several different php plugins while running this script and it still
   does not work.
 *  [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * (@doodlebee)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/#post-1861672)
 * I don’t understand “while running this script”? If you’re popping PHP code into
   a post as content, here is no “running this script”. PHP code *will not run* 
   if you insert it as text in the body of a post. You have to get a plugin and 
   allows PHP code to run when it is content in the body of your post, and you have
   to read the instructions for the plugin to see how to activate the sections of
   code that should run. (i’s not as simple as install and activate – some of them
   require the use of tags to differentiate between text and code that should be
   processed).
 * But just popping code into the body of a post won’t work – it’ll output it as
   straight text unless you use a plugin, or write your own code in your functions.
   php file that pops it in.
 *  Thread Starter [ubailey79](https://wordpress.org/support/users/ubailey79/)
 * (@ubailey79)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/#post-1861684)
 * I figured it out. I copied my page.php template and created a new template with
   the code inserted there. I then created a blank wordpress page using the new 
   template and now the code works. Thank you very much for your help on this. I
   had been struggling with this for quite some time.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding php script’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [ubailey79](https://wordpress.org/support/users/ubailey79/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/adding-php-script/#post-1861684)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
