graham23s Posted November 25, 2008 Share Posted November 25, 2008 Hi Guys, I have been reading up and using the curl functions! i'm getting there bit by bit but i have a probloem, after i login successfully i can't seem to navigate to anothe rpage! code: <?php <?php function ez_articles() { $EZ_LOGIN = "http://www.ezarticles.info/login.php"; $EZ_POST = "f_username=graham23s%40hotmail.com&f_password=XXXXXXXX&action=login&B7=Submit"; $EZ_AGENT = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)"; // ONCE WE HAVE LOGGED IN GOTO THE SUBMIT ARTICLE PAGE $EZ_SUBMIT = "http://www.ezarticles.info/submitarticles.php"; // INITIALISE CURL $c = curl_init(); curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($c, CURLOPT_URL, $EZ_LOGIN); curl_setopt($c, CURLOPT_POSTFIELDS, $EZ_POST); curl_setopt($c, CURLOPT_USERAGENT, $EZ_AGENT); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); // GOTO ANOTHER PAGE //curl_setopt($c, CURLOPT_URL, "http://www.ezarticles.info/submitarticles.php"); // EXECUTE CURL $ez_articles = curl_exec($c); // CLOSE curl_close($c); // RETURN return $ez_articles; } // END FUNCTION 1 ?> ?> thats the function i have so far! the moment i execute the 2nd page URL i get a blank page is there a certain sequence i should call the commands in at all or have i missed something? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/134285-using-curl-correctly/ Share on other sites More sharing options...
btherl Posted November 26, 2008 Share Posted November 26, 2008 The sequence should be curl_setopt(generic options), curl_setopt(first url), curl_exec(), curl_setopt(second url), curl_exec(). Did you try that sequence before or were you setting the second url before curl_exec() ? Link to comment https://forums.phpfreaks.com/topic/134285-using-curl-correctly/#findComment-699141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.