Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6806707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:44:37+00:00 2026-05-26T19:44:37+00:00

I would need to create a php file that will do some work on

  • 0

I would need to create a php file that will do some work on my webserver and that will be called from a program on another server over the internet.
Suppose the php file that will do the work is located at http://www.example.com/work.php

What is the best way to protect unsollicited calls to the http://www.example.com/work.php?

What I need is some mechanism so that when the intended program accesses the url (with some query string parameters), the work gets done, but if somebody type http://www.example.com/work.php in their browser, access will be denied and no work will be done.

The way I’ve thought is to add some ‘token’ in the querystring that would be constructed by some algorithm from the calling program, a sample result could be to append to the url :

?key=randomKeyAtEachCall&token=SomeHexadecimalResultCalculatedFromTheKey

and the key and token would be validated with a reverse algorithm on the php side.

Is that safe,
Are there any better idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:44:38+00:00Added an answer on May 26, 2026 at 7:44 pm

    You can try several thinks !

    First try to allow access only from the server that will make the call to your work.php with .htaccess like that:

    <FilesMatch "work\.php$">
        Order deny,allow
        Deny from all
        Allow from 111.111.111.111
    </FilesMatch>
    

    where 111.111.111.111 is the IP of the server that will call the script.

    Another thing you can do is to create a kind of password and send it to the work.php in order to allow the access only to users with password.

    In example.

    The server that call the script:

    $hash = md5('my_secret_key' + date('dFYaG'));
    
    // You can also use any other method you like to call the other script
    // such us cURL, sockets and so on.
    $f = fopen('http://www.myothersite.com/work.php?skr=' . $hash, 'r');
    fclose($f);
    

    and the server that hosts the work.php

    $hash = md5('my_secret_key' + date('dFYaG'));
    
    if($hash != $_GET['skr'])
    {
        die('You do not have permission to access that file...');
    }
    
    // Rest of your code goes here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need my program to create and edit a config file, which would contain
hey guys, i know how to create a simple php file that mails some
I would need to create a temp table for paging purposes. I would be
I've got an MS access database and I would need to create an SQL
I need to create hot-keys for every control + number combination and would prefer
I would need some basic vector mathematics constructs in an application. Dot product, cross
I would need to build a html table that has a horizontally scrollable column.
I've been asked to populate a flash file with some data from a database.
I'm currently working on my own PHP Framework, and I need some help figuring
I am writing a PHP application targeted at non-geeks, non-programmers. I need to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.