mrj Posted July 12, 2017 Posted July 12, 2017 My domain is: meraj.gqServer: tommyUsername: mrjIn php file_get_contents() is not working and giving 403 error.Also aspx (asp page) giving a 503 error.Please help me.
Krydos Posted July 12, 2017 Posted July 12, 2017 In php file_get_contents() is not working and giving 403 error.Which version of php are you using? Also aspx (asp page) giving a 503 error.That's because you hadn't requested aspx access yet. There you go http://meraj.gq/test.aspx 1
mrj Posted July 12, 2017 Author Posted July 12, 2017 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 3Get contents isn't working
Krydos Posted July 12, 2017 Posted July 12, 2017 (edited) 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 July 12, 2017 by Krydos figured it out 1
mrj Posted July 12, 2017 Author Posted July 12, 2017 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.
Krydos Posted July 12, 2017 Posted July 12, 2017 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.
mrj Posted July 12, 2017 Author Posted July 12, 2017 Thank you so much. Your repies was really helpfull. ☺
Recommended Posts