fopen or curl post

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    fopen or curl post

    anyone can help me to submit a post variable using curl or fopen?? easy tutorial please....

    #2
    PHP Code:
    <?php
    function call_curl($goto, $params = '')
    {
        
    $curl = curl_init(); 
        
    curl_setopt($curl, CURLOPT_URL, $goto); 
        
    curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
        if (
    $params)
        {
           
    curl_setopt($curl, CURLOPT_POST, 1);
           
    curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
        }
        
    $webrep = curl_exec($curl); 
        
    curl_close($curl); 
        return 
    $webrep; 
    }

       
    $postfields = array(
           
    'username'=>'NOname',
           
    'password'=>'admin'   
       
    );
      
    # or  $postfields = 'username=admnin&password=suk';
       
    echo call_curl('http://example.com/',$postfields);
    ?>
    Last edited by i0nutzxp; 09.07.11, 16:38.
    <?php unlink('World/Europe/Romania.country'); ?>

    Comment

    Working...
    X