Jump to content

Using Curl Correctly


graham23s

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.