Run PHP file

Posted on 2011-05-06
Last Modified: 2012-06-27
Hello Experts,

Is there an easy way to run a PHP file? E.g. I would like to run this file during one of my scripts.


Seems like fopen() isn't really the solution to that.

Thanks in advance!
Question by:sittinDuck
    LVL 14

    Expert Comment

    You can exec() /usr/bin/php with the script name as the argument.
    LVL 82

    Expert Comment

    by:Dave Baldwin
    There are several ways to run external programs on this page:
    LVL 2

    Expert Comment

    Not sure the setting that your using it in but you might want to look at using a ajax call. I like using jquey for that
    and you can get information back from the call with a success and let the customer know that the invoice seas sent or what not
    LVL 36

    Expert Comment

    by:Loganathan Natarajan
    You may simply include the file during your page call.  like this,

    LVL 48

    Expert Comment

    You could just try:

    $invoice = file_get_contents(''.$row_tabledata['id'].'&uniqueID='.$uniqueid.'&action=save');
    LVL 12

    Accepted Solution

    You can use cURL:

    This way will allow you to run script inside or outside your server.
    LVL 7

    Assisted Solution

    by:Vimal DM

    You can go for ajax execution of the file,which is of xml parsing method,even more to say of background process

    1) You may go throw the link below

    Just you can post the values.
    LVL 107

    Expert Comment

    by:Ray Paseur
    I think I would use file_get_contents() or CURL to run the script and retrieve the output into a data string.  Make sure that you have used urlencode() on all your arguments to the script.
    LVL 8

    Expert Comment

    I think url based file write/read its not possible try file_get_content() function or curl..Refer the below url it might be help your needs.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now