Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


php script with long url

  • Please log in to reply
2 replies to this topic

#1 matrixebiz


  • Members
  • 24 posts
  • Local time:12:26 PM

Posted 06 February 2017 - 02:54 PM

Hello, I'm trying to use the script below;
    $content = file_get_contents('http://example.com');
    echo $content;
but it doesn't seem to work if the url page I'm trying to get the text from is longer, like : hxxp://example.com/more/more/more
It just seems to ignore the other parts after the first /
I need the text from the page hxxp://example.com/more/more/more not hxxp://example.com

BC AdBot (Login to Remove)


#2 newage


  • Members
  • 21 posts

Posted 08 March 2017 - 07:28 AM

Your issue is probably because the "longer" url is an external URL and your shorter URL is an internal one. Your security settings in PHP might be messing with your code. Just use cURL.


        $ch curl_init(); 
        $output curl_exec($ch); 
        echo $output;



Edited by newage, 08 March 2017 - 07:51 AM.

#3 cungcapcaphe


  • Members
  • 4 posts
  • Local time:11:26 PM

Posted 08 June 2017 - 10:11 AM

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users