[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

Run PHP file

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.

invoice_creater.php?id='.$row_tabledata['id'].'&uniqueID='.$uniqueid.'&action=save

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

Thanks in advance!
0
sittinDuck
Asked:
sittinDuck
2 Solutions
 
svgmucCommented:
You can exec() /usr/bin/php with the script name as the argument.
0
 
Dave BaldwinFixer of ProblemsCommented:
There are several ways to run external programs on this page: http://us2.php.net/manual/en/function.exec.php
0
 
chemdryCommented:
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
purpose
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

include_once("invoice_creater.php?id='.$row_tabledata['id'].'&uniqueID='.$uniqueid.'&action=save");
0
 
hernst42Commented:
You could just try:

$invoice = file_get_contents('http://example.com/your/path/invoice_creater.php?id='.$row_tabledata['id'].'&uniqueID='.$uniqueid.'&action=save');
0
 
Mohamed AbowardaSoftware EngineerCommented:
You can use cURL:
http://php.net/manual/en/curl.examples.php

This way will allow you to run script inside or outside your server.
0
 
Vimal DMCommented:
Hai,

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

http://www.degraeve.com/reference/simple-ajax-example.php

Just you can post the values.
invoice_creater.php?id='.$row_tabledata['id'].'&uniqueID='.$uniqueid.'&action=save
0
 
Ray PaseurCommented:
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.
0
 
kumaranmcaCommented:
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.

http://davidwalsh.name/download-urls-content-php-curl
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now