Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:04:19+00:00 2026-06-04T00:04:19+00:00

I am trying to get a POST result but the server has block it.

  • 0

I am trying to get a POST result but the server has block it.
I have tried with

  • fsockopen
  • curl
  • file_get_contents

but I got a same result from the server as an eroor massage of “Access denied” .

Is there any way to get the POST results from the block server.

<?php
$post_arr = array ("regno" => "1"); 
    $addr = 'url'; 

    $fp = fsockopen($addr, 80, $errno, $errstr, 30); 
    if (!$fp) { 
        echo "$errstr ($errno)<br />\n"; 
    } else { 

        $req = ''; 
        foreach ($post_arr as $key => $value) { 
            $value = urlencode(stripslashes($value)); 
            $req .= "&" . $key . "=" . $value; 
        } 


        $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; 
        $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
        $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 
        fwrite($fp, $header); 
        while (!feof($fp)) { 
            echo fgets($fp, 128); 
        } 
        fclose($fp); 
    }  
?>

and also

<?php
    $postdata = http_build_query( 
        array( 
            'regno' => 1
        ) 
    ); 

    $opts = array('http' => 
        array( 
            'method'  => 'POST', 
            'header'  => 'Content-type: application/x-www-form-urlencoded', 
            'content' => $postdata 
        ) 
    ); 

    $context  = stream_context_create($opts); 

    $result = file_get_contents('url', false, $context); 
    echo $result;
?>

Both the above method give me a access denied output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:04:20+00:00Added an answer on June 4, 2026 at 12:04 am

    Try setting the HTTP_REFERER variable.

    'header'  => "Content-type: application/x-www-form-urlencoded\r\nReferer: http://urltopost\r\n",
    

    And if that doesn’t work, try to mimic more of the headers. This is what I have from looking at the Network Tab of Chrome Developer Tools:

    POST /hse/result.asp HTTP/1.1
    Host: urlhost
    Connection: keep-alive
    Content-Length: 17
    Cache-Control: max-age=0
    Origin: url
    User-Agent: something
    Content-Type: application/x-www-form-urlencoded
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Referer: url
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
    Cookie: ASPSESSIONIDASRCTADA=FBHLDODAOCBACEKMNFLJIMGO
    

    Edited to include working code:
    If you replace the $opts definition in your second code snippet with this, it will work. It works for me.

    $opts = array('http' => 
        array( 
            'method'  => 'POST', 
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n"
                        ."Referer: url\r\n",
            'content' => $postdata 
        ) 
    ); 
    

    Full code:

    <?php 
    $postdata = http_build_query( array( 'regno' => 1 ) ); 
    $opts = array('http' => array( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" ."Referer: urltopost\r\n", 'content' => $postdata ) );
    $context = stream_context_create($opts); 
    $result = file_get_contents('urltopost', false, $context);
    echo $result;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get pre/post annotations working with a web application, but for some
I'm trying to use $.post within a function, get the results, then return the
I am trying to get post a form to a hidden, dynamically inserted iframe,
I am trying to get a post-commit.bat script running on a Windows Vista Ultimate
I'm stuck trying to get a WinInet HTTP POST via SSL using ONLY C.
I am trying to get some form data from POST method. Here's the code
I'm trying to get an Android app to post highscores to Facebook, similar to
I'm trying to use the post build command line to get my class library
I'm trying to POST data from an iOS app to Node.js/Express. I cannot get
I have tried many ways of executing this but its not happening .. here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.