#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    225
    Rep Power
    1

    Question Warning: filter_input(): INPUT_REQUEST is not yet implemented in ...


    For learning purpose (to gain experience in cURL and web scraping), trying to build a mini proxy.
    I know a web proxy will encounter all sorts of pages. Pages that deal with GET method (eg. google search) and pages that deal with POST method (eg. form signup).
    Can't be writing 2 sets of codes where one is for GET and the other for POST. And so, thought best to write just one set of code to deal with both methods. And the best way to do that is write code using REQUEST which will deal with both GET and POST.
    Here is my code but for some reason I get error:

    **Warning: filter_input(): INPUT_REQUEST is not yet implemented in C:\xampp\htdocs\id\proxified_page_2.php on line 50**

    PHP Code:

    <?php

    $conn 
    mysqli_connect("localhost""root""""id");

    if (!
    $conn) {
        
    // message to use in development to see errors
        
    die("Database error : " mysqli_error($conn));

        
    // user friendly message
        // die("Database error.");
        
    exit();
    }

    ?>

    <html>
       <body>   
          <form action = "<?php $_PHP_SELF ?>" method = "GET">
             Url: <input type = "text" name = "url_to_proxify" />
                  <input type = "submit" />
          </form>      
       </body>
    </html>


    <?php

    /*
    ERROR HANDLING
    */
    ini_set('display_errors'1);
    ini_set('display_startup_errors'1);

    //For All Error, Warning and Notice
    error_reporting(E_ALL) OR error_reporting(-1);
    //For All Errors
    error_reporting(E_ERROR);
    //For All Warnings
    error_reporting(E_WARNING);
    //For All Notice
    error_reporting(E_NOTICE);

    error_reporting(E_ALL);

    /*The IF gets triggered as soon as the "submit" button is clicked in the text box labeled: Url
    Following IF code deals with GET method
    */
    if(isset($_REQUEST["url_to_proxify"]) === TRUE)
       {
            
    $url_to_proxify filter_input(INPUT_REQUEST'url_to_proxify'FILTER_VALIDATE_URL);
            
            
    $ch curl_init();
            
    curl_setopt($chCURLOPT_URL"$url_to_proxify");
            
    curl_setopt($chCURLOPT_FOLLOWLOCATIONTRUE);
            
    curl_setopt($chCURLOPT_HEADER5);
            
    curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
            
    $curl_result curl_exec($ch);
            
            
    $domain parse_url($url_to_proxifyPHP_URL_HOST);
            
            
    //eg: $pattern = array("./", "https://www.", "http://www.", "https://", "http://", "www.");
            
    $pattern = array("./""https://www.""http://www.""https://""http://""www.");
            
    $replace = array("proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'""proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'""proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'""proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'""proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'""proxified_page_2.php?url_to_proxify='.$domain.$url_to_proxify.'");
            
    $string_replaced_data str_replace($pattern$replace$curl_result);
            
            
    //Deal with Google Img File
            
    $string_replaced_data str_replace('/src="/''src="'.$domain.$url_to_proxify$string_replaced_data);
            
            echo 
    $string_replaced_data;
            
    curl_close($ch);        
        }



    ?>
    What does the error mean ?
    The last line in the following snippet was line 50:

    PHP Code:
    if(isset($_REQUEST["url_to_proxify"]) === TRUE)
       {
            
    $url_to_proxify filter_input(INPUT_REQUEST'url_to_proxify'FILTER_VALIDATE_URL); 
    Last edited by UniqueIdeaMan; July 1st, 2017 at 09:06 AM.
  2. #2
  3. No Profile Picture
    Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2017
    Location
    Tiruppur - india
    Posts
    1
    Rep Power
    0
    down vote
    I have the same problem like you. Maybe we are so rigorous but I solved the problem without compromising any security/filter.

    I used filter_var instead of filter_input.

    an example is like this:

    session_start();
    $_SESSION['baba'] = "co";
    $ses = filter_var($_SESSION['baba']);
    if (!empty($ses)) {
    echo $ses;
    }
    Last edited by requinix; July 1st, 2017 at 05:17 AM. Reason: removed spam because the rest is okay
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,290
    Rep Power
    630
    Use the proper PHP tags for your code. You apparently still haven't read the sticky at the top of this forum that says READ THIS BEFORE POSTING. Which part of "INPUT_REQUEST is not yet implemented" do you not understand? As an aside a warning is not necessarily an error.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    192
    Rep Power
    17
    I'm not trying to be an áss about it, really. But usually PHP error messages are very useful in telling you what the problem is and were it is. As a further step, I usually Google them. I have found that between these two steps, I can figure out the issue, which is a learning experience that serves me better than having someone else point a finger at a f**k up and telling me how to do it. When I do all that myself, I don't make the mistake again. Unless I'm drunk when I'm writing code, which is a very real possibility.
    Originally Posted by gw1500se
    As an aside a warning is not necessarily an error.
    So true. I run my working code with
    PHP Code:
    // Debugging code
    ini_set('display_errors'1);
    ini_set('display_startup_errors'1);
    error_reporting(E_ALL); 
    which ends up spewing out tons and tons of warnings (and errors). Comment it out, and a lot of stuff (except fatal errors) goes away...

    The reason I approach asking for help this way is because I *don't* want to ask for the solution unless the problem is really "vexing" and I', hitting a wall that I just can't negotiate. You see, I'm a lousy coder, but I want to get better...
    Originally Posted by budnetco
    ...Maybe we are so rigorous...
    Heh... OK. Or maybe not if there are errors in your code...
    Last edited by Arty Zifferelli; July 1st, 2017 at 02:17 PM.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    192
    Rep Power
    17
    I will take a stab at this...
    **Warning: filter_input(): INPUT_REQUEST is not yet implemented in C:\xampp\htdocs\id\proxified_page_2.php on line 50**
    OK, as I said, PHP error messages are quite descriptive and useful. So let's look at this. What stands out? Here's what stands out to me:
    ...is not yet implemented...
    So let's go to the PHP documentation at PHP: Predefined Constants - Manual.
    Here's what it says about INPUT_REQUEST:
    INPUT_REQUEST (integer)
    REQUEST variables. (not implemented yet)
    OK, I'm thinking PHP has not yet implemented this functionality. You're going to have to use some other REQUEST constant / variable / global to achieve your goal.

    Now honestly, I can see how you might interpret the error message as to mean YOU have not yet implemented something yet, and indeed that might be my first thought, it's a reasonable first thought. But usually one of my first steps is to crack open the documentation and have a lookie-see what the wise minds at Zend have placed withing the hallowed pages of the documentation...
    Last edited by Arty Zifferelli; July 1st, 2017 at 02:36 PM.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    225
    Rep Power
    1
    Yeah, I was referred to this more than 24hrs ago:

    Per the manual, INPUT_REQUEST is not a valid type.

    PHP: filter_input - Manual

    Closing this thread.

    Thank you all.

IMN logo majestic logo threadwatch logo seochat tools logo