Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:12:38+00:00 2026-05-28T13:12:38+00:00

From a html page I need to extract the values of v from all

  • 0

From a html page I need to extract the values of v from all anchor links…each anchor link is hidden in some 5 div tags

<a href="/watch?v=value to be retrived&amp;list=blabla&amp;feature=plpp_play_all">

Each v value has 11 characters, for this as of now am trying to read it by character by character like

<?php
$file=fopen("xx.html","r") or exit("Unable to open file!");
$d='v';
$dd='=';
$vd=array();
while (!feof($file))
  {
  $f=fgetc($file); 
  if($f==$d)
  {
  $ff=fgetc($file);
  if ($ff==$dd)
  { 
  $idea='';
  for($i=0;$i<=10;$i++)
  {      
$sData = fgetc($file);
$id=$id.$sData;
  }      
  array_push($vd, $id);

That is am getting each character of v and storing it in sData variable and pushing it into id so as to get those 11 characters as a string(id)…
the problem is…searching for the ‘v=’ through the entire html file and if found reading the 11characters and pushing it into a sData array is sucking, it is taking considerable amount of time…so pls help me to sophisticate the things

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:12:39+00:00Added an answer on May 28, 2026 at 1:12 pm
    <?php
    function substring(&$string,$start,$end)
    {
        $pos = strpos(">".$string,$start);
        if(! $pos) return "";
        $pos--;
        $string = substr($string,$pos+strlen($start));
        $posend = strpos($string,$end);
        $toret = substr($string,0,$posend);
        $string = substr($string,$posend);
        return $toret;
    }
    $contents = @file_get_contents("xx.html");
    
    $old="";
    $videosArray=array();
    while ($old <> $contents)
    {
    $old = $contents;
    $v = substring($contents,"?v=","&");
    if($v) $videosArray[] = $v;
    }
    
    //$videosArray is array of v's
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use WWW::Mechanize to extract some links from the HTML page using
I need to extract the src element from all image tags in an HTML
I'm trying to extract the price from the bellow html page/link using php cURL
I have some HTML and I need to extract the actual written text from
I'm using BeautifulSoup to parse a HTML page. I need to extract all URLs
I need to extract a hidden input from a html document <input type=hidden name=email
I need to read some content from a html page. I've tested simple_html_dom ,
I want extract the path of images from a html page using PHP-preg_match_all(), the
I want a regular expression to extract the title from a HTML page. Currently
What is the preferred way to extract elements from a HTML page in Java?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.