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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:23:17+00:00 2026-06-02T18:23:17+00:00

I am using cURL over PHP to access an ASPX website. On my browser

  • 0

I am using cURL over PHP to access an ASPX website. On my browser it shows that upon request I get a 302 Found (which is redirecting actually to another site), and immediately another request to the redirect page.

On my cURL I always get the 200 OK, which is ironically wrong , as the next page I am accessing (immitating the redirect) returns a 500, prehaps something was done wrong in the previous page.

as a test I tried to access my own website on which I am redirecting the page. I also got a 200 OK on the curl_getinfo($curl); but the contents of the returned page showed specifically that the header was HTTP/1.1 302 Found
one more weird thing is that the curl_getinfo($curl); returns a 200 OK all the time, even when I access my own website when I actually know I am redirecting.

Any ideas why I get a 200 OK instead of a 302 on my curl_getinfo?

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-02T18:23:19+00:00Added an answer on June 2, 2026 at 6:23 pm

    In addition to the CURLOPT_FOLLOWLOCATION answers:
    You can also set the CURLOPT_HEADERFUNCTION option and take a look at the redirect(s), e.g. via

    curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header');
    ...
    curl_exec($ch);
    ...
    function read_header($curl, $header) {
      echo $header;
      return strlen($header);
    }
    

    With CURLOPT_FOLLOWLOCATION enabled you should get an output like

    HTTP/1.0 301 Moved Permanently
    Date: Fri, 20 Apr 2012 11:26:37 GMT
    Server: Apache
    Location: http://www.spiegel.de/
    Content-Length: 230
    Content-Type: text/html; charset=iso-8859-1
    X-Cache: MISS from lnxp-3968.srv.mediaways.net
    X-Cache-Lookup: MISS from lnxp-3968.srv.mediaways.net:91
    Via: 1.0 lnxp-3968.srv.mediaways.net (squid/3.1.4)
    Connection: close
    
    HTTP/1.0 200 OK
    Date: Fri, 20 Apr 2012 11:25:38 GMT
    Server: Apache-Coyote/1.1
    X-Powered-By: Servlet 2.4; JBoss-4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)/Tomcat-5.5
    Cache-Control: max-age=120
    Expires: Fri, 20 Apr 2012 11:27:38 GMT
    X-Host: lnxp-2885
    X-Robots-Tag: index, follow, noarchive
    Content-Type: text/html;charset=ISO-8859-1
    Content-Length: 161305
    Vary: Accept-Encoding
    Age: 59
    X-Cache: HIT from lnxp-3954.srv.mediaways.net
    X-Cache-Lookup: HIT from lnxp-3954.srv.mediaways.net:90
    Via: 1.1 www.spiegel.de, 1.0 lnxp-3954.srv.mediaways.net (squid/3.1.4)
    Connection: close
    

    which in this case shows that a request for http://spiegel.de is redirected to http://www.spiegel.de

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

Sidebar

Related Questions

I'm using curl to make php send an http request to some website somewhere
Using cURL I can send a GET request with a body. Example: curl -i
I'm using cURL to log in, like so: curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_URL,'http://www.website.com/login.php'); curl_setopt($ch,
I am using cURL in PHP to write a function to get a remote
I'm using a web interface that allows me to post stuff over a cURL
Im using curl to fetch my Twitter favorites: <?php $username = bob; $password =
I'm using cURL to get the XML file for my Twitter friend's timeline. (API
passing post data using cURL requires that the name of the input. However, I
i get page in utf-8 with russian language using curl. if i echo text
I am using libcurl's easy interface to access network devices over HTTP, currently using

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.