www.webdeveloper.com
Results 1 to 7 of 7

Thread: How do I run local files? Can you help?

  1. #1
    Join Date
    Oct 2012
    Location
    istanbul
    Posts
    64

    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

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,154
    Depends on whether you want to run it as a web app in a browser or as a command line app.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Oct 2012
    Location
    istanbul
    Posts
    64
    Quote Originally Posted by NogDog View Post
    Depends on whether you want to run it as a web app in a browser or as a command line app.
    Thank you for reply.

    I want to run it as a web app in a browser.

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,154
    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).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    Mar 2012
    Posts
    1,120
    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".

  7. #7
    Join Date
    Oct 2012
    Location
    istanbul
    Posts
    64
    You understood wrong. I want to do this.

    There is no problem.
    PHP Code:
            $url "http://www.mydomain.com/run/file.php";     
            
    $ch curl_init();  
            
    curl_setopt($chCURLOPT_URL$url);  
            
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
    curl_setopt($chCURLOPT_TIMEOUT,300);  
            
    $out curl_exec($ch);
            
    $output trim($out);        
            
    curl_close($ch);

           
    $mysqlibag->query("INSERT INTO table (id, column)values (NULL, '$output'); 
    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?
    PHP Code:
            $url "/run/file.php";     
            
    $ch curl_init();  
            
    curl_setopt($chCURLOPT_URL$url);  
            
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
    curl_setopt($chCURLOPT_TIMEOUT,300);  
            
    $out curl_exec($ch);
            
    $output trim($out);        
            
    curl_close($ch);

           
    $mysqlibag->query("INSERT INTO table (id, column)values (NULL, '$output'); 
    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles