1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What am i doing wrong here? urgent

Discussion in 'PHP' started by rudeturk, Mar 19, 2008.

  1. #1
    I need help please
    Im recieving this error:
    Pretty sure its this line causing the problem
    $url = "http://www.youtube.com/get_video?".$videoid"&t="$vars;
    PHP:
    Can anyone help arrange the line please so it doesnt get errors? reps will be added.
     
    rudeturk, Mar 19, 2008 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    $url = "http://www.youtube.com/get_video?".$videoid."&t=".$vars;
    dots after $videoid and before $vars;
     
    AsHinE, Mar 19, 2008 IP
    rudeturk likes this.
  3. rudeturk

    rudeturk Well-Known Member

    Messages:
    884
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Thanks reped.
     
    rudeturk, Mar 19, 2008 IP
  4. rudeturk

    rudeturk Well-Known Member

    Messages:
    884
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    120
    #4
    one more thing
    
    $url = "http://youtube.com/api2_rest?method=youtube.videos.get_video_token&video_id=IvNkGm8mxiM";
    if ($contents = @file_get_contents($url)) {
    if (preg_match('/t>.*</', $contents, $match)) {
    $vars = $match[0];
    echo "$vars";
    }
    }
    PHP:
    Any help here? doesnt return anything
     
    rudeturk, Mar 19, 2008 IP
  5. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #5
    I tried your regexp and it gives me some results, but they are incorrect
    Try this one instead.
    if (preg_match('/t>(.+?)</', $content, $match)) {
    	$vars = $match[1];
    }
    PHP:
    If you still got nothing try echo your $content, maybe you got banned or something like that?
     
    AsHinE, Mar 19, 2008 IP
  6. rudeturk

    rudeturk Well-Known Member

    Messages:
    884
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Thanks but i tried it on 3 of my servers and it didnt work,
    what did it return you?
     
    rudeturk, Mar 19, 2008 IP
  7. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #7
    I got this from
    echo file_get_contents("http://youtube.com/api2_rest?method=youtube.videos.get_video_token&video_id=IvNkGm8mxiM");
    
    PHP:
    <?xml version="1.0" encoding="utf-8"?>
    <ut_response status="ok"><t>OEgsToPDskL-SqZ2g0LBxhiYl9Myv5kh</t></ut_response>
    Code (markup):
     
    AsHinE, Mar 20, 2008 IP