create php script to reference other script indirectly

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
marchello
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Oct 30, 2017 6:10 am

Mon Oct 30, 2017 6:20 am

Hi together,

I'm very new to php.
How do I create php script to reference other script indirectly?

I got some file in apache2 html directory /var/www/html/magento/app/code/core/Mage/Oauth/Helper/Data.php that is forbiddent to access directly.

Code: Select all

$ curl -X POST -H "Authorization: OAuth realm="",oauth_callback="http%3A%2F%2Fmagento.local%2Fapi.php%3Ftype%3Drest%26products%26limit%3D100",oauth_version="1.0",oauth_consumer_key="425f9fd0138f85ef167f310a5ec4f219",oauth_timestamp="1509143057",oauth_nonce="B18CC568585DC84F71EDF3A1C68C3317",oauth_signature_method="HMAC-SHA1",oauth_signature="SdYszI36H+J7zDYGLAr8IRjcQ+U="" "http://magento.local/app/code/core/Mage/Oauth/Helper/Data.php"
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /app/code/core/Mage/Oauth/Helper/Data.php
on this server.<br />
</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at magento.local Port 80</address>
</body></html>
(just in case, it's local web server with test credentials).

Why I need that file, it's because I am about to pass oauth initiate autorization and found this using grep:

Code: Select all

$ grep -i "oauth/initiate" /var/www/html/magento/* -R
/var/www/html/magento/app/code/core/Mage/Oauth/Helper/Data.php:    const ENDPOINT_INITIATE                  = 'oauth/initiate';
just a piece of code from /var/www/html/magento/app/code/core/Mage/Oauth/Helper/Data.php :

Code: Select all

class Mage_Oauth_Helper_Data extends Mage_Core_Helper_Abstract
{
    /**#@+
     * Endpoint types with appropriate routes
     */
    const ENDPOINT_AUTHORIZE_CUSTOMER        = 'oauth/authorize';
    const ENDPOINT_AUTHORIZE_ADMIN           = 'adminhtml/oauth_authorize';
    const ENDPOINT_AUTHORIZE_CUSTOMER_SIMPLE = 'oauth/authorize/simple';
    const ENDPOINT_AUTHORIZE_ADMIN_SIMPLE    = 'adminhtml/oauth_authorize/simple';
    const ENDPOINT_INITIATE                  = 'oauth/initiate';
    const ENDPOINT_TOKEN                     = 'oauth/token';
    /**#@-*/

...

    /**
     * Available endpoints list
     *
     * @var array
     */
    protected $_endpoints = array(
        self::ENDPOINT_AUTHORIZE_CUSTOMER,
        self::ENDPOINT_AUTHORIZE_ADMIN,
        self::ENDPOINT_AUTHORIZE_CUSTOMER_SIMPLE,
        self::ENDPOINT_AUTHORIZE_ADMIN_SIMPLE,
        self::ENDPOINT_INITIATE,
        self::ENDPOINT_TOKEN
    );
As a result, it should be a kind of script that will allow me to access oauth/initiate of the /var/www/html/magento/app/code/core/Mage/Oauth/Helper/Data.php file.

Please advise.
Thx ahead.

magento ver. 1.9.3.6
php ver. 5.6.32-1
ubuntu 16.04.1
apache/2.4.18

Post Reply