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 9185571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:18:37+00:00 2026-06-17T19:18:37+00:00

I have a php + curl function that captures the HTTP 301 responses. The

  • 0

I have a php + curl function that captures the “HTTP 301” responses. The page is named get_header.php and is located in the folder /exe:

function getheader($url)
// Use curl to fetch the HTTP Headers
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1); // just the header
curl_setopt($ch, CURLOPT_NOBODY, 1); // not the body
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
preg_match('/Location: (.*)\n/', $output, $matches);
// if no redirect header then return the original url
return isset($matches[1]) ? $matches[1] : $url;
}
echo(getheader($_GET['url']));

However, I need to use this script in a classic asp page. I tried to call it via HTTP:

Dim x: Set x = CreateObject("MSXML2.ServerXMLHTTP")     
Dim y: y = "http://mysite.com/exe/get_header.php?url=" & url
x.Open "GET", y, false 
x.Send()
Dim z: z = x.ResponseText

Although it works, this is not the ideal solution since both pages are on the same domain. In fact it has generated slowness of requests. So how could I solve this problem? The ideal solution would be a vbscript or javascript version of my PHP function. Thanks!

  • 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-17T19:18:38+00:00Added an answer on June 17, 2026 at 7:18 pm

    Here’s the solution:

    Dim x: Set x = CreateObject("WinHttp.WinHttpRequest.5.1")
    x.Option(6) = False
    x.Open "GET", url, false
    x.Send()
    If x.status = 301 Then
    Dim z: z = x.getResponseHeader("Location")
    End If
    

    Thanks to FAngel for your replies!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP script that uses CURL to fetch a remote page and
I have a simple php curl function that goes to another site(not owned by
I have a PHP script that loads a function which uses Curl to log
I have a function that makes HTTP requests with cURL that falls back to
I have a php script that uses exec() function to execute curl to download
i have php function that parses a xml url and gives me an array.this
I have a piece of PHP code that uses cURL to do post requests,
i have a curl function that visits a website, logs in to said website,
I have a PHP page that will collect mp3 links from downloads.nl. The result
I have a php function that fetches and returns tweets data from twitter as

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.