Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End File get problem in php

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #146289
    Anonymous
    Inactive

    Hello everyone!
    I have a problem about php file_get_contents() function, this function works other sites but when I want to make this in my localserver starts problem, error is: ” failed to open stream: Redirection limit reached, aborting in “.
    Although, I tried much way for fixing this problem, also I tried curl but problem is the same, i need help

    #146293
    Alen
    Participant

    You reached the maximum number of redirects. This is due to either error in the file name, so the server can not find the file, or the server you are connecting has some security measures in place.

    #146296
    Anonymous
    Inactive

    This is like a joke, because this site is my, which I want to connect with file_get_contents(), I write that site using a codeigniter but I don’t know why is this problem, I searched this in google, made examples for fixing this, but nothing…
    You tald me that maybe this file can not find on the server, but when I’m typing same url file is exists, now I think this is the codeigniter security measures, but I don’t know how to fix it, I really need it

    #146298
    Alen
    Participant

    Yes. But you are trying to access something from your localhost development machine. This could be your problem. What type of file are you trying to get? Show us some code so we can see what you’re trying to do.

    #146303
    Anonymous
    Inactive

    My file url is in my localserver: http://localhost/img/slide1.png
    I need this file and other files download in my directories, is other ways for downloading image using php?

    #146312
    Alen
    Participant

    Use readfile():

    $file_to_get = 'http://media.npr.org/assets/img/2013/05/16/daftpunk02-e8b444451c5efffe911009c9045fb0a382973adf-s6-c30.jpg';
    $file_info = getimagesize($file_to_get);
    header("Content-type: ".$file_info['mime']);
    echo readfile($file_to_get);
    
    #146313
    Anonymous
    Inactive

    @Alen Look at this photo: Photo URL same problem

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.