Curl error does not follow request

Asked

Viewed 94 times

0

I am creating a field of donations from my website remotely interconnected with another but am having problems in redirecting, post dates to the page: https://www.kickante.com.br/campanhas/pastor-de-ovelhas/apoiar and what should happen is to follow the request to the content of the page https://www.kickante.com.br/checkout/4242170 more for some error is returning error code 404 not found my code appears to be correct however it does not work as it should work

<?php

$ch = curl_init();
$url = "https://www.kickante.com.br/campanhas/pastor-de-ovelhas/apoiar";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "amount=100%2C00&op=Quero+contribuir%21&form_build_id=form-PNMhiIetNqWfqwL6oc1EtvA_5sG3-J3KEErIg_5Y30o");
$result = curl_exec($ch);
curl_close($ch);
unset($ch);

?>

  • Try to capture the request error with: if($Errno = curl_errno($ch)) ? $error_message = curl_strerror($Errno); echo "Curl error ({$Errno}): n {$error_message}"; } so it is possible to know what is occurring

  • 1

    For that you don’t need to use the CURLOPT_FOLLOWLOCATION?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.