I have a php file on a website (example: https://www.site1.com/script.php).
This script outputs some html, basically just text formatted with <h2>, <p> and so on.
I need to put this text inside a div, in a remote web page on another site (example: https://www.site2.com/page.php), then style it with css.
I don't need to load or execute script.php code, but just its "output", as you can see opening the php file from the browser
Alternative solutions than using "include" and allow_url_include in the php.ini?
just used:
echo file_get_contents("https://www.site1.com/script.php");
Related
Using Google App Engine, I'm trying to display a PHP page that contains html, within which I have more html content from another source. I'm using a PHP tag to include the content, like so:
< ?php include "https://myfileURL.html"; ?>
But it does not show up in the page source code. The html file is in a "/HTML/" folder which is handled as a static_dir in app.yaml. I can access the URL from the browser and the content is there, but if I put that URL in the include tag I get nothing. I can even put bad URLs and I get no errors, no console output... just nothing. The page displays with white space in the middle of the source code.
Any idea what's going on here? Everything works perfectly in localhost.
Argh... backend process... need to catch errors in php, nevermind.
One of my file is read by php and loaded on the Web UI. But if the file contains HTML tags, it interprets and disturbs the whole UI.
How to ignore the HTML tags while reading the file contents.
I am using following code to read file contents:
readfile($name);
I think what you are looking for is htmlspecialchars function.
e.g. echo htmlspecialchars($stringFile);
If you want to strip all html tags, check strip_tags function.
I have an html file called enter.html and php file called form.php .My php file does not contain any html tag. And I posted my form infos through post method php proceeds it but php file does not show in browser . It directly downloads itsel automatically.Why? But If I take php scripts into html tag the file shows in browser.
This might be usefull.
Is your server turned on?
http://www.php.net/manual/en/tutorial.firstpage.php
I have a PHP file which might contain lot of PHP tags, scripts and HTML.
I need to get only HTML div inside the php file. The file contain lot of <?php > tags. I want to ignore those tags and to get only HTML from the page using jQuery.get().
Is it possible to do this?
When you open a .php file in your browser, the server executes the PHP files and only gives HTML (+javascipt +css) back. JavaScript is then executed in your browser and you won't have any <?php ?> tags inside. Therefore you can simply use jQuery selectors.
I downloaded a Template + CSS File for a Website that I'm Building, the template worked well until I tried to break it down and put every code in its own file (for easy modification and editing in the future).
So, when I cut the head part which included (Title + Meta Data .. etc ), and put it in its own file, and replaced it (for sure) with an include() function, I lost the CSS styles and returned to the basic & standard style (Black & white with no extra format .. etc)
Where did I Go wrong? Knowing that here is the include function that I've used:
<?php
include 'files/head.php';
?>
With an URL like file:///C:/xampp/htdocs/test6/index.php PHP is NOT executed. You must run it with apache being involved. Currently you are opening your PHP script as a regular txt or html file - it is just passed to browser without processing.
In order to make include function work you must run it with apache. As you are using xamp, I think you should simply open it with URL like http://localhost/test6/index.php In this case, apache will get that request and pass it to PHP. PHP engine will interpret your PHP script and "replace" include files/head.php with a content of head.php.
If everything is Ok, after pressing Ctrl+U (or looking at HTML with Developer Tools or Firebug) you should see a content of head.php instead of <?php include ....
Please note that css files should be linked with relative URL like css/screen.css. Or absolute URL like http://localhost/test6/css/screen.css. like Search for relative and absolute URLs in google for more info.