SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    USA
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CurL and PHP Help To Grap The Register Page

    Hello


    I have this small code

    <?php
    # Add a user to vBulletin (offline)

    function qpc_post($varname)
    {
    return trim(stripslashes((get_magic_quotes_gpc()) ? $_POST[$varname] : addslashes($_POST[$varname])));
    }

    define('THIS_SCRIPT', 'bb_add_user.php');
    require_once('./global.php');
    require_once('./includes/class_dm.php');
    require_once('./includes/class_dm_user.php');

    $userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);

    $userdm->set('username', qpc_post('username'));
    $userdm->set('email', qpc_post('email'));
    $userdm->set('password', qpc_post('password'));
    $userdm->set('usergroupid', 2);
    $userdm->set('ipaddress', qpc_post('ipaddress'));
    $userdm->set('referrerid', qpc_post('referrername'));
    $userdm->set('timezoneoffset', qpc_post('timezoneoffset'));
    $userdm->set_bitfield('options', 'adminemail', intval(qpc_post('adminemail')));
    $userdm->set_bitfield('options', 'showemail', intval(qpc_post('showemail')));

    $dst_setting = intval(qpc_post('dst'));
    switch ($dst_setting)
    {
    case 0:
    case 1:
    $userdm->set_bitfield('options', 'dstonoff', $dst_setting);
    break;
    case 2:
    $userdm->set_bitfield('options', 'dstauto', 1);
    break;
    }

    #If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
    if (count($userdm->errors)) {
    for($i=0; $i<count($userdm->errors); $i++) {
    print "ERROR{$i}:{$userdm->errors[$i]}\n";
    }
    } else {
    # If everything is OK
    $newuserid = $userdm->save();
    print "vbuserid:$newuserid\n";
    }


    ?>

    I add this code in forum root called add_bb.php

    then i created anther file

    <?php

    $url="/forums/add_bb.php";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_POST, 1);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=keith_mayass&email=keith_mayass@no_worrys.com&password=up_yours&usergr oupid=2&");
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    $store = curl_exec ($ch);
    $content = curl_exec ($ch); # This returns HTML
    curl_close ($ch);

    ?>
    i call it Reg.php

    know if i go to reg.php i get blank page i have no idea .. could someone take a look at both code and tell me what wrong ?

    thankyou
    Favorite Site : xProxy

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm....

    and his signature includes a link to a proxy site....

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    USA
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher
    hmmm....

    and his signature includes a link to a proxy site....
    is this is spam or what ?
    Favorite Site : xProxy

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2003
    Location
    Melbourne, Australia
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dream On
    know if i go to reg.php i get blank page i have no idea .. could someone take a look at both code and tell me what wrong ?
    Assuming that your curl function calls are correct (don't know since I've rarely used curl), your problem is that you're not echo the contents you've captured.
    PHP Code:
    $content curl_exec ($ch); // Content is saved in a variable
    curl_close ($ch);
    //Now send $content to the browser
    echo $content
    Zealotry is contingent upon 100 posts and addiction 200?


Bookmarks

Posting Permissions

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