HELP: PHP String Manipulation Related Problem

Discussion in 'PHP' started by honeystar0812, Jan 26, 2011.

  1. #1
    PATTERN: Input:
    http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-6515811997029694&output=html&h=250&slotname=2638665468&w=300&lmt=1295223106&flash=10.1.102.64&url=http%3A%2F%2Fwww.prostatecancerguide.net%2FGleason-scale.php&dt=1295223106729&shv=r20101117&jsv=r20110114&saldr=1&prev_slotnames=3369741726%2C5211073747%2C8537021660&correlator=1295223106229&frm=0&adk=3654972279&ga_vid=844010415.1295223106&ga_sid=1295223106&ga_hid=82990496&ga_fc=0&u_tz=-300&u_his=3&u_java=1&u_h=800&u_w=1280&u_ah=770&u_aw=1280&u_cd=32&u_nplug=0&u_nmime=0&biw=1259&bih=526&eid=30143103&ref=http%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dgleason%2Bscale%26rls%3Dcom.microsoft%3Aen-us%26ie%3DUTF-8%26oe%3DUTF-8%26startIndex%3D%26startPage%3D1%3B&fu=0&ifi=4&dtd=31&xpc=zfdAdXSut7&p=http%3A//www.prostatecancerguide.netthe

    Function should RETURN:
    http://googleads.g.doubleclick.net/pagead/ads?....url=www.prostatecancerguide.net....&ref=...gleason...

    Obviously, it will return all the readable parts of the url and omit the garbages.. Thanks guys.
     
    honeystar0812, Jan 26, 2011 IP
  2. G3n3s!s

    G3n3s!s Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #2
    you want to cut that text and you do not know how ?

    copy here function you use
     
    G3n3s!s, Jan 26, 2011 IP
  3. honeystar0812

    honeystar0812 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $tok = strtok($webAddress, "1234567890%&=q");
    $str='';
    $flag_qm=0;
    while ($tok !== false) {
    echo "Word=$tok<br />";
    if($flag_qm==0){
    $exp = explode('?',$tok);
    echo "Explode=$exp[0]?<br />";
    $str=$str . $exp[0] . '?';
    $flag_qm=1;
    }
    $exp = explode('F',$tok);
    if(explode('F',$tok)) {
    echo "<br />Yes";
    }
    else {
    echo "<br />No";
    }
    echo "<br />Explode= $exp[1]<br />";
    if(exp)
    $str=$str.$exp[1] . '.';
    $tok = strtok("1234567890%&=/q");
    }
     
    honeystar0812, Jan 26, 2011 IP
  4. jsimpson

    jsimpson Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you elaborate more what you want to do ?
     
    jsimpson, Jan 28, 2011 IP