0

I am trying to login to my A site from my B site. So I simulate a login form using curl and I expect to redirect to my A site's main member page. But instead my B site url remain on my address bar and my browser shows my Site A login page. I am new to curl. Thank you for reading.

$cc = curl_init($url);
    curl_setopt($cc, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($cc, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($cc, CURLOPT_HEADER, true);
    curl_setopt($cc, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($cc, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($cc, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($cc, CURLOPT_POST, true);  
    curl_setopt($cc, CURLOPT_POSTFIELDS, $postString);
    return curl_exec($cc);
    curl_close($cc);
    //echo $result;
    //exit;

1 Answer 1

1

Using curl your server makes a request to A and receives a response. It has nothing to do with the client.

                 1) request         2) request (curl)
                   --->               --->
Client (browser)           Server B          Server A
                   <---               <---
                 4) response        3) response

If you want to tell the client something or redirect him, you have to do so in your response to the client. curl won't do anything like this. For example, use header('Location: http://a.com') to redirect the client in step 4.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.