PHP cURL uzantılı bir siteye giriş yapmaya çalışıyor

0 Cevap php

Temelde, bir siteye giriş için çalışıyorum. Ben giriş var, ama site sitenin başka bir bölümüne yönlendirir, ve bunu yaparken üzerine, o da benim tarayıcı yönlendirir.

Örneğin:

Bu başarıyla http://example.com/login.php içine günlükleri

Ama sonra benim tarayıcı http://mysite.com/site.php?page=loggedin gider

Ben sadece bunun için yönlendirilecek, sayfanın içeriğini değil dönmek istiyorum.

Bunu nasıl yaparım?

İstendiği gibi, burada benim kodu

// create curl resource 
$ch = curl_init(); 

// set url 
curl_setopt($ch, CURLOPT_URL, $loginURL); 

//Some setopts
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWREDIRECT, FALSE);
curl_setopt($ch, CURLOPT_REFERRER, $referrer);

// $output contains the output string 
$output = curl_exec($ch); 

// close curl resource to free up system resources 
curl_close($ch);

echo $output;   

0 Cevap