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

  • Home
  • SEARCH
  • 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 946611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:56:47+00:00 2026-05-15T22:56:47+00:00

I have to run a get request from a PHP script, but I’m in

  • 0

I have to run a get request from a PHP script, but I’m in a fairly limited environment (tight firewalls, can’t modify the PHP install, etc…).

fsockopen() returns an error and http_get() seems to not be installed. The only other way I know of is to call file_get_contents(), which works OK, except for the fact that I need to set the referrer header in the request (which I don’t think you can do with file_get_contents().

Does anyone know any other way to run a GET request via php?

Thanks!

edit: also, CURL is unavailable. 🙁

  • 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-05-15T22:56:48+00:00Added an answer on May 15, 2026 at 10:56 pm

    You can set the a header using file_get_contents() with an HTTP context. For example

    $opts = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Accept-language: en\r\n" .
                  "Referer: http://foo.bar.com\r\n"
      )
    );
    
    $context = stream_context_create($opts);
    $fp = fopen('http://www.example.com', 'r', false, $context);
    fpassthru($fp);
    fclose($fp);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android client with a http GET request invoking a php script
I have some scripts that get run often, always from within a connected SQLPlus
I have a php script that needs to run for quite some time. What
Possible Duplicate: Simple PHP Mailer Script i run a small website and we have
I have to request data for a JS-script from a MySQL database (based upon
I have managed to get a cron job to run a rake task by
I have this code and I couldn't run it because i get this error:
I get this error when I run the code below. I have normally used
I have a task which has to be run everyday. I will get just
I was wondering how to get this to run. In my application I have

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.