Curl Redirect error

Why is not my Curl code redirecting? What is wrong?

Thanks

[php]<?php
error_reporting(E_all);
ini_set(‘display_errors’,1);

$ch = curl_init();

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, 'https://ssoportais2.tokiomarine.com.br/openam/XUI/#login/&realm=TOKIOLFR&goto=https://portalparceiros.tokiomarine.com.br/');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$retorno = curl_exec($ch);

if($retorno===false){
    echo '<br>erro:'.curl_error($ch);
}
curl_close($ch);

print_r($retorno);

?>[/php]

Help me… :’(

What output are you getting when you dump the request? I can’t run it due to geo filters at the office.

I only wanted to display the page, but I can not get it.
Placing the URL in the browser works without problems

Then, why display the page with cURL? file_get_contents(), iframes, and include would all be more useful with that process then cURL.

If I delete curl_setopt($ch, CURLOPT_HEADER, true); I get the exact page html returned when I view the source.

I deleted curl_setopt ($ ch, CURLOPT_HEADER, true); And returned the site blank.

As for using file_get_contents (), I need to use CURL, because in a next step I will submit the form, the problem is that because of the redirect, I can not even display the URL.

I mentioned the CURLOPT_POST method

[php] <?php
error_reporting(E_all);
ini_set(‘display_errors’,1);

			$ch = curl_init();

			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
			curl_setopt($ch, CURLOPT_URL, 'https://ssoportais2.tokiomarine.com.br/openam/XUI/#login/&realm=TOKIOLFR&goto=https://portalparceiros.tokiomarine.com.br/');
		//	curl_setopt($ch, CURLOPT_HEADER, true);
			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			//curl_setopt($curl, CURLOPT_POST, 1);
			//curl_setopt($ch, CURLOPT_POSTFIELDS, 'idToken1='.$idToken1.'&idToken2='.$idToken2);
			
			$retorno = curl_exec($ch);

			if($retorno===false){
				echo '<br>erro:'.curl_error($ch);
			}
			curl_close($ch);

			print_r($retorno);
			?>

[/php]

Why do you need to submit a form on your site, that is for another???

I need to get the information that comes after the submit and bring it to my site

So, copying their listings.

I did not understand.

What I need is to get into a site, which is not mine, log in, and get the information I need.

The problem is that, in the first step, I try to call the site through the curl, and it does not return anything to me.

If I change the CURLOPT_URL to another site, for example curl_setopt ($ ch, CURLOPT_URL, ‘phphelp.com’); It returns me, but it does not work with the site I need, this is problem.

Sponsor our Newsletter | Privacy Policy | Terms of Service