Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request use file_get_contents #40

Closed
kamov opened this issue Jun 2, 2013 · 4 comments
Closed

Request use file_get_contents #40

kamov opened this issue Jun 2, 2013 · 4 comments

Comments

@kamov
Copy link

kamov commented Jun 2, 2013

Hi,

I see that Request class use file_get_contents function.

This is disable on my server for security reason.

On line 53 there is:

'body' => file_get_contents('php://input')

Can you replace this with cURL example:

function file_get_contents_curl($url) {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);       

    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
}
@philo23
Copy link

philo23 commented Jun 2, 2013

I'm fairly certain this wouldn't fix your problem, php://input is a wrapper to access stdin using the standard file handling functions like readfile(), file() and file_get_contents(). The curl extension as far as I'm aware has no support for this.

You might be able to get around the restrictions on your server using some of the information displayed here: http://php.net/manual/en/wrappers.php.php (eg: $HTTP_RAW_POST_DATA) but even so I doubt this will be added into Flight.

@kamov
Copy link
Author

kamov commented Jun 2, 2013

Hi,

thanks for info.

Currently I am working on localhost, where allow_fopen is enabled.
But I am worry regarding when I upload on my server.

But in this case is not an external link, right?

On my server is disabled only for external link.

It's first time that I see this method. I will check into link that you kindly provide.

Thanks

@kafene
Copy link
Contributor

kafene commented Jun 3, 2013

Chances are on such a limited server you are never going to be doing request methods other than GET and POST so I would just comment that line out or not worry about it, it will always be empty.

Also if this is actually disabled by allow_url_fopen I'd report that to PHP.net as a bug, since even though it has a URL format, it is not a URL, it's an internal PHP resource.

@kamov
Copy link
Author

kamov commented Jun 3, 2013

Thank you Kafene.

I will go to close this as solved.

Best regards

@kamov kamov closed this as completed Jun 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants