Get IP of the Author only
Another option is to use Rules on new content creation then run the php code.


  The Rules module allows site administrators to define conditionally
  executed actions based on occurring events (known as reactive or ECA
  rules). It's a replacement with more features for the trigger module
  in core and the successor of the Drupal 5 workflow-ng module.


EDIT:


Enable the module 'PHP Filter'
In Rules, use the 'After Saving New Content' React on Type - this will trigger each time content is published for the first time
Optionally, add a condition Restrict by Type, choose the content type in which you want this to appear
Add a new action 'PHP: Execute custom php code' with your own code