3

We have a website that posts data to another website, once that data is send we include a php file. after the php file is included the var_dump doesn't give back the required information ("data received"). I thought it might have been curl at first but when I tried adding the data to a database it didn't do anything either. So by now I asume the code just doesn't continue. when I echo the 'received data' before the getData function it will display the echo if I add it behind the getData function it doesnt display.

Website1:

if(isset($_POST['password'])) {
    $password = sha1($_POST['password']);
}

$post = [
        $password,
];

$ch = curl_init("http://localhost/JoomlaToJoomlaPlugin/WebsiteOne/plugins/system/controlplugin/encrypted.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
}

Website2:

    function __construct() {
    $items = null;

    if(isset($_POST)) {
        $items = $_POST;
    }

    $this->pass = $items[0];

    if(Encrypted::checkHash()) {
            echo 'received data!';
            Encrypted::getData();
                echo 'THIS DOES NOT DISPLAY!!!!!!!!';
            Encrypted::sendDatabackTest();
    } else {
        echo 'error';
    }
}

private function getData() {
    require_once(JPATH_BASE .DS.'libraries/cms/version/version.php');

    echo JVersion::getShortVersion();
henk
  • 31
  • 2
  • 1
    I would guess that as require_once will crash the script if the file it is trying to find is not there it is a simple case of the wrong path being used in the require_once. **look at your PHP Error log** there will be a error message confirming this if this is the case **Always check your PHP error log before anything else** or run with `display_errors = On` so you see the errors on the screen – RiggsFolly Apr 22 '16 at 09:35
  • No errors found in the error log. The path is correct also display_errors = on. Doesn't show any errors either. – henk Apr 22 '16 at 10:03
  • Well what else in in that `getData()` method? – RiggsFolly Apr 22 '16 at 10:08
  • require_once(JPATH_BASE .DS.'libraries/cms/version/version.php'); echo JVersion::getShortVersion(); I think it crashes by the require_once. – henk Apr 22 '16 at 10:09
  • You mean that is the complete content of that method – RiggsFolly Apr 22 '16 at 10:09
  • yes that is the only thing. – henk Apr 22 '16 at 10:10
  • Try adding an echo before the require and after the require see which ones you see – RiggsFolly Apr 22 '16 at 10:10
  • I did. the one before it echos perfectly. the one after... doesn't – henk Apr 22 '16 at 10:12
  • Add this code before the require `if ( file_exists(JPATH_BASE .DS.'libraries/cms/version/version.php') ) { echo 'require should work'; } else { echo 'Opps'; }` – RiggsFolly Apr 22 '16 at 10:18
  • string 'require should work – henk Apr 22 '16 at 10:20
  • same. the only thing I can think off is that curl doesnt allow including files – henk Apr 22 '16 at 10:25

0 Answers0