/    Sign up×
Community /Pin to ProfileBookmark

How do I run local files? Can you help?

Hello,

How do I run local files? Can you help?

/folder/filename.php
ı will write output to database.

Thanks

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 02.2013 — Depends on whether you want to run it as a web app in a browser or as a command line app.
Copy linkTweet thisAlerts:
@AdemauthorSep 02.2013 — Depends on whether you want to run it as a web app in a browser or as a command line app.[/QUOTE]
Thank you for reply.

I want to run it as a web app in a browser.
Copy linkTweet thisAlerts:
@NogDogSep 02.2013 — Then you need to install a web server on your local machine (along with PHP and whatever DBMS you are using). If you are using MySQL, the simplest way is to use one of the installers that install all 3, such as Wampserver (Windows only) or XAMPP (most OS's/platforms), which will install Apache, PHP, and MySQL for you.

Once installed, you make sure your PHP files are in or under the configured web root directory, then access it via a "localhost" URL, e.g.: "http://localhost/my_script.php" (NOT from the browser's "File" menu option).
Copy linkTweet thisAlerts:
@jedaisoulSep 02.2013 — Just to add to NogDog's comments, wamp can be configured to work across a local network. To access it, you substitute the local address of the machine it is running on for "localhost". E.g. If wamp is running on the machine "192.168.0.2", instead of "http://localhost/my-script.php", use "http://192.168.0.2/my-script.php".
Copy linkTweet thisAlerts:
@AdemauthorSep 08.2013 — You understood wrong. I want to do this.

There is no problem.
[code=php]
$url = "http://www.mydomain.com/run/file.php";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,300);

$out = curl_exec($ch);
$output = trim($out);

curl_close($ch);

$mysqlibag->query("INSERT INTO table (id, column)values (NULL, '$output');
[/code]


But I want to do this without full URL.

This cURL is for example. How can I run this $url = "/run/file.php"; without full URL? What can I run it with?
[code=php]
$url = "/run/file.php";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,300);

$out = curl_exec($ch);
$output = trim($out);

curl_close($ch);

$mysqlibag->query("INSERT INTO table (id, column)values (NULL, '$output');
[/code]


Thanks
×

Success!

Help @Adem spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...