Computer Science Canada

receiving data from external site for parsing.

Author:  TokenHerbz [ Wed Aug 09, 2017 11:44 pm ]
Post subject:  receiving data from external site for parsing.

Overview: This other website I have access to as a USER, thats it.. It can send me two versions of the page on each load to my custom website where i can parse the DATA from it. Either the html and/or a COPY/PASTE type format.

Now my problem is I cant seem to get anything on POST to even see the data, on my website.

Here is some code.

code:

<?php

# These headers must be present or else user will get errors.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST');
header('Access-Control-Max-Age: 1000');

if ($_POST) {
    # Raw content of game div
    $data_html = $_POST['data_html'];
    # Content from game div as if user had copy pasted (useful for making parsers that also work with copy/paste)
    $data_simple = $_POST['data_simple'];
    # Url from where data came from (useful for parsing)
    $url = $_POST['url'];
    # Province that sent intel (will be different when sitting)
    $province = $_POST['prov'];
    # Key (You should give the kingdom, if not each user a personal key so you can restrict access)
    $key = $_POST['key'];
    $example_array = array($url,$province,$key);
    #
    # Your parse functions here
    #
    # Return json object with first instance being success: True
    # If you do not do this, user will get an error.
    echo json_encode(array('success'=>true));
}
$imp = implode(",", $_POST);
echo("<script>console.log('PHP POST: ". $imp."');</script>");

?>


On their website after loading a page I get a successful : XHR finished loading: POST "https://FakeWebsite.com/self_info_test.php".

The only error i get however, from their website is a pop-up that says "Something is wrong with your endpoint.".
I check their console.logs and i cant really find as to what the problem could be, and samething on my end so if you see something out of place let me know.

The POST should contain certain elements but its blank,

thanks!

Author:  TokenHerbz [ Thu Aug 10, 2017 12:09 am ]
Post subject:  RE:receiving data from external site for parsing.

On their end I get :

http://imgur.com/a/mkwTG


: