0
I have the following code:
$fields = array('usuario'=>urlencode($jm->Login),'senha'=>$jm->Senha);//url-ify the data for the POST
$fields_string = '';
foreach($fields as $key=>$value) {
$fields_string .= $key.'='.$value.'&'; }
$url = "https://www.sitecliente.com.br/validar/";
$ch = curl_init();//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);//execute post
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
$result = curl_exec($ch);//close connection
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "STATUS: ";
print_r($status);
curl_close($ch);
The goal is to click on a link within our system, to be directed to an external system. When we do this, it validates, but the page is empty. When you print the status, it returns the message: STATUS: 303.
I found that this error may be because we are using the POST and we should use the GET. How I would do this?
Hi Daniel. I changed the code, but the problem remains.
– user24136
@Fox.11, I can’t do anything with vague information.
– Daniel Omine
Hello Daniel, the information I can give you is that. I would like to access an external system via post, but it validates correctly, but does not direct and when I print the status, returns the 303. I don’t know if it’s the way I’m programming Curl, so I’d like help...
– user24136
Yes, that’s very clear. But there’s nothing I can do. I don’t know how you are doing, how is the code of the page that receives the data, how you tried to make the changes, what are the conditions of the environments, etc.. Anyway, these are the details. I can try to "kick" dozens of options to solve but this is unproductive and out of focus, making this question a technical support service.
– Daniel Omine