-1

EDIT: SOLVED - Thanks to the comment by @Adam

I have my index.php page, which all included functionality, until now, has worked. I've written a small script (pasted below), using the Simple HTML DOM library to scrape an external webpage for an element value. This value is stored as $newprice inside the script. However, when I place the script anywhere in the code, it a) doesn't run, and b) breaks all HTML/PHP/JS code preceding it.

<?php
  include_once('../simple_html_dom.php');
  $html = file_get_html('https://www.affordrentacar.co.uk/');
  $traverse = $html->find('span.offer-price', 0);
  $newprice = $traverse->plaintext;
?>

I've copied this script to one of my other PHP pages and tested echoing out the $newprice variable and that works fine. What could be causing this?

Alex
  • 376
  • 1
  • 17
  • 2
    What does your error log say? Also, are you sure the Simple Dom library is where you're including it from? – Adam Mar 22 '19 at 15:51
  • 1
    What is the error generated by the code. The term "doesn't run" is quite hard to debug. I am guessing that you can find some error logs on the server. – Cosmin Staicu Mar 22 '19 at 15:51
  • 1
    @Adam Well then, I guess this is one of those times where I let something stupid slip past me... the simple dom path was off by 1 directory! All fixed, cheers :) – Alex Mar 22 '19 at 15:53
  • Possible duplicate of [PHP's white screen of death](https://stackoverflow.com/questions/1475297/phps-white-screen-of-death) – Russ J Mar 22 '19 at 16:50

1 Answers1

2

try to display errors :

error_reporting( E_ALL^E_NOTICE );
ini_set('display_errors', 1);

can be problem with connections, your local settings don't work with https

Vencendor
  • 132
  • 1
  • 4