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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.