View unanswered posts | View active topics It is currently Tue Nov 28, 2023 5:20 pm



Reply to topic  [ 3 posts ] 
 file_get_contents not working 
Author Message
Junior Member

Joined: Sat Jun 20, 2009 4:16 am
Posts: 3
Post file_get_contents not working
Hello all,

This is my code:

PHP Code:
$url = "Show.php?ShowID=1";
$str = file_get_contents($url);
echo $str;

That's supposed to get the contents of show.php with showID as 1. But this doesn't work. Just typing show.php works, but the ?showID=1 does not work.

How could I make it so that it works?

Thanks

_________________
Hello


Thu Nov 12, 2009 6:08 am
Report this post
Profile WWW
Junior Member

Joined: Sun Nov 22, 2009 8:05 pm
Posts: 1
Post Your first PHP-enabled page
Example #1 Our first PHP script: hello.php
[PHP]
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
[/PHP]
Use your browser to access the file with your web server's URL, ending with the /hello.php file reference. When developing locally this URL will be something like http://localhost/hello.php or http://127.0.0.1/hello.php but this depends on the web server's configuration. If everything is configured correctly, this file will be parsed by PHP and the following output will be sent to your browser:

[HTML]<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
[/HTML]
This program is extremely simple and you really did not need to use PHP to create a page like this. All it does is display: Hello World using the PHP echo() statement. Note that the file does not need to be executable or special in any way. The server finds out that this file needs to be interpreted by PHP because you used the ".php" extension, which the server is configured to pass on to PHP. Think of this as a normal HTML file which happens to have a set of special tags available to you that do a lot of interesting things.
If you tried this example and it did not output anything, it prompted for download, or you see the whole file as text, chances are that the server you are on does not have PHP enabled, or is not configured properly. Ask your administrator to enable it for you using the Installation chapter of the manual. If you are developing locally, also read the installation chapter to make sure everything is configured properly. Make sure that you access the file via http with the server providing you the output. If you just call up the file from your file system, then it will not be parsed by PHP. If the problems persist anyway, do not hesitate to use one of the many ยป PHP support options.
The point of the example is to show the special PHP tag format. In this example we used <?php to indicate the start of a PHP tag. Then we put the PHP statement and left PHP mode by adding the closing tag, ?>. You may jump in and out of PHP mode in an HTML file like this anywhere you want. For more details, read the manual section on the basic PHP syntax.



__________________
eco diagnostic pret taux zero immobilier |Credit pret a taux zero 0 |Pret taux zero a 0


Sun Nov 22, 2009 8:08 pm
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.