I have a form that asks for a email and city. The city select also redirects the page to a /examplecity part of the site. The email is then process and a conformation is sent to the user. If the user exists already the page redirects to the error page.
Any idea how to suppress the error page and just move on? I have tried a few curl options but no results.
Here is my code.
//form
$Curl_Session = curl_init('http://alist-manage.com/subscribe/post?u=08fd07d8be6c7c671&id=960c347');
curl_setopt ($Curl_Session, CURLOPT_POST开发者_StackOverflow社区, 1);
curl_setopt($Curl_Session, CURLOPT_NOSIGNAL, TRUE);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "&group=$group&MERGE0=$email");
//
//curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_exec ($Curl_Session);
curl_close ($Curl_Session);
setcookie("city", $city, time()+604800); // cookie expires in 7 days.
header("Location: http://site.ca/".$city."");
exit();
Ok, so the http://www.alist.com/ page redirects to an error page if the user doesn't exist, and you want it to go straight to the http://site.ca/ page?
Try adding this:
curl_setopt($Curl_Session,CURLOPT_RETURNTRANSFER,true);
精彩评论