Results 1 to 2 of 2

Thread: curl() on PHP.

  1. #1

    Thread Starter
    Addicted Member thamizhinpan's Avatar
    Join Date
    Dec 2005
    Location
    TE
    Posts
    243

    curl() on PHP.

    I would like learn about curl() on PHP.
    I have downloaded many codes to get address books from gmail,yahoo, etc
    But I have sufficient knowledge on that topic.
    So I want to know the answers for these questions
    Can I use this curl for access any sites which contains login forms?
    How can I do this?
    If above question or answer will help to you
    Don't forget to rate me
    தமிழ்இன்பன்

  2. #2

    Thread Starter
    Addicted Member thamizhinpan's Avatar
    Join Date
    Dec 2005
    Location
    TE
    Posts
    243

    Re: curl() on PHP.

    Hi I have learned a bit about it.
    My testing target is http://sms.wow.lk
    This site can send a sms to our phones.(Only for my country)

    So I wrote code like this
    PHP Code:


    <?php $page '';
    $cookie_jar tempnam('/tmp','cookie');

    // for logon into site
    $c curl_init('http://sms.wow.lk/user/login.php');
    curl_setopt($cCURLOPT_POST1);
    curl_setopt($cCURLOPT_POSTFIELDS'Username=vbforums&Password=test&Action=login');
    curl_setopt($cCURLOPT_RETURNTRANSFER1);
    curl_setopt($cCURLOPT_FOLLOWLOCATION1);
    curl_setopt($cCURLOPT_COOKIEJAR$cookie_jar);

    curl_exec($c);
    curl_close($c);

    //Send SMS
    $c curl_init('http://sms.wow.lk/user/sendmessages.php');
    curl_setopt($cCURLOPT_POST1);
    curl_setopt($cCURLOPT_POSTFIELDS'message=Test123&sizebox=6&Action=send&1054427=checkbox');
    curl_setopt($cCURLOPT_RETURNTRANSFER1);
    curl_setopt($cCURLOPT_FOLLOWLOCATION1);
    curl_setopt($cCURLOPT_COOKIEJAR$cookie_jar);

    $page curl_exec($c);
    curl_close($c);

    // remove the cookie jar
    unlink($cookie_jar) or die("Can't unlink $cookie_jar");

    echo 
    $page;


    ?>
    But I can login sucessfully and but I can't able to send SMS.
    What is the problem on my code?
    If above question or answer will help to you
    Don't forget to rate me
    தமிழ்இன்பன்

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width