How to generate content to Drupal 7 with a PHP-script?
You can use contrib module for that purpose

Devel


  Generate content
  
  Accelerate development of your site or module by quickly generating
  nodes, comments, terms, users, and more.


Dummy content


  DC allow your custom module to provide demo nodes as soon as the
  module is installed - this helps with populating blocks, views, and
  generally showcasing your module's functionality. This is very useful
  when showcasing a module's functionality to a client. For example,
  rather than installing the Forum module and having to manually create
  forum nodes, the DC API can be used to pre-populate the site with
  forum-type nodes as soon as the Forum module is enabled. Additionally,
  rather than having purely Lorem Ipsum-type content, you can define
  relevant pieces of text and images, giving the content a more complete
  &amp; realistic look &amp; feel.


Note:  Both modules will create random content.