File_get_contents function does not work with windows? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
file_get_contents("https://api.groupon.com/v2/deals.xml?division_id=cleveland&client_id=39ddf70c45844d5a9d5a92e5106f1b229b2e1df8");
This code does not work on windows, but does with Linux. Because of https. Is there any solution.

It's possible you did not enable your url file open in your PHP configuration.
See http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen for details on this configuration value.
If this is not the cause, then you should specify what the exact error is, do this by adding the following to your code, before the file_get_contents function:
error_reporting(E_ALL);
ini_set('display_errors', 'On');

Related

Configurations for a php application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Well am creating a php based application therefore I wish to accompany it with a configuration file. However the configuration will have a few variables which will be updated once in a while.
Therefore how can I read a file and update a specific variable in it?
It's common to define your own configuration in .ini files and parse them with parse_ini_file()

shell_exec and exec functions can not produce an output file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have a server and client. Server has a php file. Here it is:
$postdata = $_FILES['request'];
$reqContent= file_get_contents($postdata['tmp_name']);
shell_exec("echo ".$reqContent." > request.txt");
I sent a file from client to server with this command :
curl -i -F "request=#example.txt" <server_url>
But output file(request.txt) can not created.How can i solve this problem?
Check your webserver error logs to verify that your not getting an error like 'permission denied' when you test that.
Also you might try shell_exec('pwd') and a shell_exec('whoami') and check the permissions on that directory to verify that the webserver user that is executing the command has permission to write there.

Directory of the page a file is included in [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am including a page in the directory all with the function basename(__DIR__) which is in the directory inc, so echo basename(__DIR__); returns the directory inc, instead of directory all.
How can I fix this?
Maybe, the best way is define some specific constant in file that placed in all folder and then included into other?
define('ALL_PATH', realpath(dirname(__FILE__)));

Error on including a file - Warning: include(connect.php): failed to open stream: No such file or director [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
Here is the image of project file structure -
I added include 'connect.php' in index.php file.
Index.php file is present in register folder. But i get an error 'failed to open stream no such file'.
You could add a simple DOCUMENT_ROOT to your include in which way it will always go for the direct server path to the file.
include $_SERVER["DOCUMENT_ROOT"]."/connect.php";

How to uploading of file with out browse in php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to upload some files without browse button, i just wanna have a fixed path and upload button, can anyone help me out, i think this is possible in asp.net
There is no way for a website to specify which file the user's browser should upload. This would be a dangerous security risk as the user might not notice the file selection.

Categories