Page 1 of 1

Curl Cannot Follow Redirect

Posted: Fri Jan 22, 2016 9:41 am
by Grandong
Hi... Please Help me to understand this problem:

this my case:
1. i try to login site via php curl

first, i need to visit login page Here
ths my code:

Code: Select all

		$ch = curl_init($url);
		curl_setopt($ch, CURLOPT_COOKIESESSION, true);
		// curl_setopt($ch, CURLOPT_HEADER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	    curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
	    curl_setopt($ch, CURLOPT_TIMEOUT_MS, 30000);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',));
		curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
		$result = curl_exec($ch);
	    $curl_errno = curl_errno($ch);
	    $curl_error = curl_error($ch);
	    if ($curl_errno > 0) {
	    	print_r($curl_errno);
	    }
	    print_r($result);
but, process stop in Connecting...

Please Help Me...

Re: Curl Cannot Follow Redirect

Posted: Fri Jan 22, 2016 4:34 pm
by Christopher
You may need to use CURLOPT_CUSTOMREQUEST. Read the docs.