403 http code appears when I go to a certain website

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I wrote a PHP script to a particular site using a home computer for debugging. Script worked properly, when I tested it on a home computer. The script has stopped working when I deploy the script on the server (CentOS).



I thought, that I made a mistake when writing the script, and created this issue.



Chuan Ma suggested that the website administration blocked server IP. I wrote to the admins and they said that they do not block the IP.



My problem is that I can not go to the site using the server. I tried several tools for getting html of the site.



  1. I have tried to use the browser. I deployed on my server this script and went to the site as a real user. When I visit the site using the browser, I get an error (http code 403).



  2. I have tried curl from the command line.



    server:~# curl http://4pda.ru/
    <html>
    <head><title>403 Forbidden</title></head>
    <body bgcolor="white">
    <center><h1>403 Forbidden</h1></center>
    <hr><center>nginx</center>
    </body>
    </html>



  3. I tried the utility wget.



    server:~# wget http://4pda.ru --quiet -O -
    server:~#


I do not know what to do now. I would welcome any advice.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I wrote a PHP script to a particular site using a home computer for debugging. Script worked properly, when I tested it on a home computer. The script has stopped working when I deploy the script on the server (CentOS).



    I thought, that I made a mistake when writing the script, and created this issue.



    Chuan Ma suggested that the website administration blocked server IP. I wrote to the admins and they said that they do not block the IP.



    My problem is that I can not go to the site using the server. I tried several tools for getting html of the site.



    1. I have tried to use the browser. I deployed on my server this script and went to the site as a real user. When I visit the site using the browser, I get an error (http code 403).



    2. I have tried curl from the command line.



      server:~# curl http://4pda.ru/
      <html>
      <head><title>403 Forbidden</title></head>
      <body bgcolor="white">
      <center><h1>403 Forbidden</h1></center>
      <hr><center>nginx</center>
      </body>
      </html>



    3. I tried the utility wget.



      server:~# wget http://4pda.ru --quiet -O -
      server:~#


    I do not know what to do now. I would welcome any advice.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I wrote a PHP script to a particular site using a home computer for debugging. Script worked properly, when I tested it on a home computer. The script has stopped working when I deploy the script on the server (CentOS).



      I thought, that I made a mistake when writing the script, and created this issue.



      Chuan Ma suggested that the website administration blocked server IP. I wrote to the admins and they said that they do not block the IP.



      My problem is that I can not go to the site using the server. I tried several tools for getting html of the site.



      1. I have tried to use the browser. I deployed on my server this script and went to the site as a real user. When I visit the site using the browser, I get an error (http code 403).



      2. I have tried curl from the command line.



        server:~# curl http://4pda.ru/
        <html>
        <head><title>403 Forbidden</title></head>
        <body bgcolor="white">
        <center><h1>403 Forbidden</h1></center>
        <hr><center>nginx</center>
        </body>
        </html>



      3. I tried the utility wget.



        server:~# wget http://4pda.ru --quiet -O -
        server:~#


      I do not know what to do now. I would welcome any advice.










      share|improve this question















      I wrote a PHP script to a particular site using a home computer for debugging. Script worked properly, when I tested it on a home computer. The script has stopped working when I deploy the script on the server (CentOS).



      I thought, that I made a mistake when writing the script, and created this issue.



      Chuan Ma suggested that the website administration blocked server IP. I wrote to the admins and they said that they do not block the IP.



      My problem is that I can not go to the site using the server. I tried several tools for getting html of the site.



      1. I have tried to use the browser. I deployed on my server this script and went to the site as a real user. When I visit the site using the browser, I get an error (http code 403).



      2. I have tried curl from the command line.



        server:~# curl http://4pda.ru/
        <html>
        <head><title>403 Forbidden</title></head>
        <body bgcolor="white">
        <center><h1>403 Forbidden</h1></center>
        <hr><center>nginx</center>
        </body>
        </html>



      3. I tried the utility wget.



        server:~# wget http://4pda.ru --quiet -O -
        server:~#


      I do not know what to do now. I would welcome any advice.







      centos wget curl http






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 23 '17 at 12:39









      Community♦

      1




      1










      asked Jun 28 '13 at 6:55









      Denis

      11314




      11314




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          403 forbidden means that the webserver is configured to not allow you to do what you're trying to do. In most cases, it's either of the following:



          • The script does not have execute permissions on the server (i.e. it's uploaded with -rw-r--r-- instead of -rwxr-xr-x, or maybe -rwx------

          • The script is in a directory that the server does not have access to due to the directory/file permissions

          • The server is configured to not allow access to files in that directory (in this case, you need to look at the server's httpd.conf)

          Edited with yet another potential reason



          Another reason can be that the server is configured with mod_security, which may require a full set of HTTP headers. This is a protection against a lot of crack/dos attacks often used by script kiddies. If this is the case, make sure that your script sends the HTTP header



          User-Agent: A suitable name for your script


          If that doesn't help, you need to ask the server administrator for the site that's failing your script and ask them what their HTTP logs say.






          share|improve this answer






















          • I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
            – Denis
            Jun 28 '13 at 8:00










          • OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
            – Jenny D
            Jun 28 '13 at 8:55











          • I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
            – Jenny D
            Jun 28 '13 at 9:01










          • Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
            – Denis
            Jun 28 '13 at 9:10










          • Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
            – Jenny D
            Jun 28 '13 at 9:13

















          up vote
          0
          down vote













          Try this with the needed URL (I write google as an example):



          wget --header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/8.0 Safari/600.1.17" 'https://www.google.es'





          share|improve this answer








          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Why would the website require a particular user agent?
            – RalfFriedl
            10 mins ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f80983%2f403-http-code-appears-when-i-go-to-a-certain-website%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          403 forbidden means that the webserver is configured to not allow you to do what you're trying to do. In most cases, it's either of the following:



          • The script does not have execute permissions on the server (i.e. it's uploaded with -rw-r--r-- instead of -rwxr-xr-x, or maybe -rwx------

          • The script is in a directory that the server does not have access to due to the directory/file permissions

          • The server is configured to not allow access to files in that directory (in this case, you need to look at the server's httpd.conf)

          Edited with yet another potential reason



          Another reason can be that the server is configured with mod_security, which may require a full set of HTTP headers. This is a protection against a lot of crack/dos attacks often used by script kiddies. If this is the case, make sure that your script sends the HTTP header



          User-Agent: A suitable name for your script


          If that doesn't help, you need to ask the server administrator for the site that's failing your script and ask them what their HTTP logs say.






          share|improve this answer






















          • I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
            – Denis
            Jun 28 '13 at 8:00










          • OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
            – Jenny D
            Jun 28 '13 at 8:55











          • I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
            – Jenny D
            Jun 28 '13 at 9:01










          • Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
            – Denis
            Jun 28 '13 at 9:10










          • Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
            – Jenny D
            Jun 28 '13 at 9:13














          up vote
          0
          down vote













          403 forbidden means that the webserver is configured to not allow you to do what you're trying to do. In most cases, it's either of the following:



          • The script does not have execute permissions on the server (i.e. it's uploaded with -rw-r--r-- instead of -rwxr-xr-x, or maybe -rwx------

          • The script is in a directory that the server does not have access to due to the directory/file permissions

          • The server is configured to not allow access to files in that directory (in this case, you need to look at the server's httpd.conf)

          Edited with yet another potential reason



          Another reason can be that the server is configured with mod_security, which may require a full set of HTTP headers. This is a protection against a lot of crack/dos attacks often used by script kiddies. If this is the case, make sure that your script sends the HTTP header



          User-Agent: A suitable name for your script


          If that doesn't help, you need to ask the server administrator for the site that's failing your script and ask them what their HTTP logs say.






          share|improve this answer






















          • I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
            – Denis
            Jun 28 '13 at 8:00










          • OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
            – Jenny D
            Jun 28 '13 at 8:55











          • I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
            – Jenny D
            Jun 28 '13 at 9:01










          • Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
            – Denis
            Jun 28 '13 at 9:10










          • Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
            – Jenny D
            Jun 28 '13 at 9:13












          up vote
          0
          down vote










          up vote
          0
          down vote









          403 forbidden means that the webserver is configured to not allow you to do what you're trying to do. In most cases, it's either of the following:



          • The script does not have execute permissions on the server (i.e. it's uploaded with -rw-r--r-- instead of -rwxr-xr-x, or maybe -rwx------

          • The script is in a directory that the server does not have access to due to the directory/file permissions

          • The server is configured to not allow access to files in that directory (in this case, you need to look at the server's httpd.conf)

          Edited with yet another potential reason



          Another reason can be that the server is configured with mod_security, which may require a full set of HTTP headers. This is a protection against a lot of crack/dos attacks often used by script kiddies. If this is the case, make sure that your script sends the HTTP header



          User-Agent: A suitable name for your script


          If that doesn't help, you need to ask the server administrator for the site that's failing your script and ask them what their HTTP logs say.






          share|improve this answer














          403 forbidden means that the webserver is configured to not allow you to do what you're trying to do. In most cases, it's either of the following:



          • The script does not have execute permissions on the server (i.e. it's uploaded with -rw-r--r-- instead of -rwxr-xr-x, or maybe -rwx------

          • The script is in a directory that the server does not have access to due to the directory/file permissions

          • The server is configured to not allow access to files in that directory (in this case, you need to look at the server's httpd.conf)

          Edited with yet another potential reason



          Another reason can be that the server is configured with mod_security, which may require a full set of HTTP headers. This is a protection against a lot of crack/dos attacks often used by script kiddies. If this is the case, make sure that your script sends the HTTP header



          User-Agent: A suitable name for your script


          If that doesn't help, you need to ask the server administrator for the site that's failing your script and ask them what their HTTP logs say.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 28 '13 at 9:00

























          answered Jun 28 '13 at 7:43









          Jenny D

          10.3k22744




          10.3k22744











          • I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
            – Denis
            Jun 28 '13 at 8:00










          • OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
            – Jenny D
            Jun 28 '13 at 8:55











          • I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
            – Jenny D
            Jun 28 '13 at 9:01










          • Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
            – Denis
            Jun 28 '13 at 9:10










          • Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
            – Jenny D
            Jun 28 '13 at 9:13
















          • I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
            – Denis
            Jun 28 '13 at 8:00










          • OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
            – Jenny D
            Jun 28 '13 at 8:55











          • I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
            – Jenny D
            Jun 28 '13 at 9:01










          • Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
            – Denis
            Jun 28 '13 at 9:10










          • Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
            – Jenny D
            Jun 28 '13 at 9:13















          I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
          – Denis
          Jun 28 '13 at 8:00




          I'm sorry, I want to clarify whether I have understood you. I have a server (VDS, CentOS). Using this server, I want to get the html code of a website. I use CURL (PHP) for this task. When I want to get, for example, the html code of the Google page, everything works correctly. When I want to get the html code of the site 4pda.ru, I get a 403 http response code. That is, the script works correctly in the general case, but it does not work for the site 4pda.ru.
          – Denis
          Jun 28 '13 at 8:00












          OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
          – Jenny D
          Jun 28 '13 at 8:55





          OK, then I completely misunderstood you - I thought you meant that you were trying to access your own script. I think I may have an idea though; let me edit my answer.
          – Jenny D
          Jun 28 '13 at 8:55













          I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
          – Jenny D
          Jun 28 '13 at 9:01




          I've edited my answer now. I have seen that particular issue several times as the place I work with is using mod_security, and about every three months I get some script developer asking me why their script doesn't work for our site.
          – Jenny D
          Jun 28 '13 at 9:01












          Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
          – Denis
          Jun 28 '13 at 9:10




          Jenny D, thanks for the new answer. Unfortunately, I am sending identical user request headers. You're probably right, I have to again talk to the administrator.
          – Denis
          Jun 28 '13 at 9:10












          Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
          – Jenny D
          Jun 28 '13 at 9:13




          Darn. It might be some other header they're requesting though - but yes, at this point all we have is guesses. I hope you get a good answer from your sysadmin!
          – Jenny D
          Jun 28 '13 at 9:13












          up vote
          0
          down vote













          Try this with the needed URL (I write google as an example):



          wget --header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/8.0 Safari/600.1.17" 'https://www.google.es'





          share|improve this answer








          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Why would the website require a particular user agent?
            – RalfFriedl
            10 mins ago














          up vote
          0
          down vote













          Try this with the needed URL (I write google as an example):



          wget --header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/8.0 Safari/600.1.17" 'https://www.google.es'





          share|improve this answer








          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

















          • Why would the website require a particular user agent?
            – RalfFriedl
            10 mins ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          Try this with the needed URL (I write google as an example):



          wget --header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/8.0 Safari/600.1.17" 'https://www.google.es'





          share|improve this answer








          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          Try this with the needed URL (I write google as an example):



          wget --header="User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/8.0 Safari/600.1.17" 'https://www.google.es'






          share|improve this answer








          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 17 mins ago









          Carlos AG

          101




          101




          New contributor




          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Carlos AG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.











          • Why would the website require a particular user agent?
            – RalfFriedl
            10 mins ago
















          • Why would the website require a particular user agent?
            – RalfFriedl
            10 mins ago















          Why would the website require a particular user agent?
          – RalfFriedl
          10 mins ago




          Why would the website require a particular user agent?
          – RalfFriedl
          10 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f80983%2f403-http-code-appears-when-i-go-to-a-certain-website%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)