cURL-POSTing Problem

Discussion in 'PHP' started by afimafis, Feb 16, 2012.

  1. #1
    Hi,

    i try codes below.whenever i test script on "Live HTTP headers" and "HTTPFox". they say that method is GET method.but i am sure that it is POST script.
    i dont know how is it possible.

    thanks



    <?php


    function curl_download()


    {


    $url = 'https://twitter.com/sessions?phx=1';
    $reffer = "https://twitter.com/";
    $post = "session%5Busername_or_email%5D=Saldivarekr&session%5Bpassword%5D=pymwyqjz&return_to_ssl=true&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A1329407037872%7D%22%5D&redirect_after_login=";




    $ch = curl_init();


    //curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
    //curl_setopt($ch, CURLOPT_PROXY, '184.22.162.137:3128:afimafis:12345678');
    //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_MAXREDIRS,10);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_REFERER, $reffer);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "C:/cookie.txt");
    curl_setopt ($ch, CURLOPT_COOKIEJAR, "C:/cookie.txt");
    curl_setopt ($ch, CURLOPT_POST, true);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, "session%5Busername_or_email%5D=USERNAME&session%5Bpassword%5D=PASSWORD&return_to_ssl=true&scribe_log=%5B%22%7B%5C%22event_name%5C%22%3A%5C%22web%3Afront%3Alogin_callout%3Aform%3Alogin_click%5C%22%2C%5C%22noob_level%5C%22%3Anull%2C%5C%22internal_referer%5C%22%3Anull%2C%5C%22user_id%5C%22%3A0%2C%5C%22page%5C%22%3A%5C%22front%5C%22%2C%5C%22_category_%5C%22%3A%5C%22client_event%5C%22%2C%5C%22ts%5C%22%3A1329407037872%7D%22%5D&redirect_after_login=");
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);




    $data = curl_exec ($ch);
    $info = curl_getinfo($ch);
    print_r($info);
    //print_r($ch);
    print_r($data);
    curl_close($ch);




    echo $data;


    }


    print curl_download();


    ?>
     
    afimafis, Feb 16, 2012 IP
  2. MouleFlip

    MouleFlip Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Curlopt_post...
     
    MouleFlip, Feb 16, 2012 IP
  3. afimafis

    afimafis Greenhorn

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    i did that ...

     
    afimafis, Feb 16, 2012 IP