Jump to content

File_Get_Contents() Not Working


mrj

Recommended Posts

My domain is: meraj.gq

Server: tommy

Username: mrj

In php file_get_contents() is not working and giving 403 error.

Also aspx (asp page) giving a 503 error.

Please help me. :)

Link to comment
Share on other sites

Thanks for your reply. Currently using PHP 5.6.3.0. Waiting for your reply. :)

 

get_headers() also not working. Is it for target server restrictions or something? I tried fusionbd.com as $url and it was worked. Here is the code:

<?php

$url ="http://m.sumirbd.mobi";

$get_contents = file_get_contents($url);

$get_headers = array(get_headers($url));

if ($get_contents) {

echo "Get contents is working!";

} else {

echo "Get contents isn't working";

}

if ($get_headers) {

//print_r($get_headers);

} else {

echo "Get headers isn't working";

}

?>

Output:

Warning: file_get_contents(http://m.sumirbd.mobi): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/mrj/public_html/p.php on line 3

Get contents isn't working

Link to comment
Share on other sites

It should work on 5.6. Are you sure you aren't using 5.5 or something else?

 

Ah, figured it out. The error isn't our server at all:

 

This is not a problem in your script, its a feature in you partners web server security.

 

It's hard to say exactly whats blocking you, most likely its some sort of block against scraping. If your partner has access to his web servers setup it might help pinpoint.

 

What you could do is to "fake a web browser" by setting the user-agent headers so that it imitates a standard web browser.

Source: https://stackoverflow.com/questions/11680709/file-get-contents-give-me-403-forbidden

 

That particular website has some protection against people using file_get_contents on it. If you use curl with good headers you can get the data from them without them knowing it's not a real browser. That wouldn't stop them from figuring out that the requests are coming from a server not a real persons IP address and if they're really zealous about not having their data scraped they could always block our IP...

Edited by Krydos
figured it out
  • Like 1
Link to comment
Share on other sites

Thank you. Its worked :) . The last thing I want to know that which scripting is bulit in enabled and which are need to be enabled by requesting on tommy server. Like I had requested for java and asp and it was enabled for me. Do I need to request for perl, python, ruby and otherss? Thanks in advance.

Link to comment
Share on other sites

Do I need to request for perl, python, ruby and otherss?

Not really. You can install ruby gems yourself through cpanel. If you need a particular version of python or some module installed let us know. The idea behind requesting java and requesting mono is it takes a lot of server resources for each account that those are enabled on so we want only the people who actually need it to have it active.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...