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 7186239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:35:23+00:00 2026-05-28T18:35:23+00:00

I am using this code to download video from you tube (it is a

  • 0

I am using this code to download video from you tube (it is a robot.php file used in downloading process)

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

require_once('lib/youtube.lib.php');
if(eregi('youtube.com|localhost',$_GET['url'])){
    if(!eregi('www.',$_GET['url'])){
        $_GET['url'] = str_replace('http://','http://www.',$_GET['url']);
    }
    list($video_id,$download_link) = get_youtube($_GET['url']);
            ?>
    <p>
    <img src="http://img.youtube.com/vi/<?php echo trim($video_id);?>/1.jpg" alt="Preview 1" class="ythumb" />
    <img src="http://img.youtube.com/vi/<?php echo trim($video_id);?>/2.jpg" alt="Preview 2" class="ythumb" />
    <img src="http://img.youtube.com/vi/<?php echo trim($video_id);?>/3.jpg" alt="Preview 3" class="ythumb" />
    </p>
    <p>
    <a href="<?php echo trim($download_link);?>" class="ydl" title="Download as FLV">Download FLV</a>
    <a href="<?php echo trim($download_link);?>&fmt=18" class="ydl" title="Download as MP4">Download MP4</a>
    <a href="<?php echo trim($download_link);?>&fmt=17" class="ydl" title="Download as 3GP">Download 3GP</a>
    </p>
    <?php
}
else{
    die('<span style="color:red;">Sorry, the URL is not recognized..</span>');
}
?>

running this, I get error

Deprecated: Function eregi() is deprecated in
D:\wamp\www\u\code\robot.php on line 6

and line 6 is

if(eregi(‘youtube.com|localhost’,$_GET[‘url’]))

searching stackoverflow i got

if (!function_exists('eregi')) {
        function eregi($find, $str) {
            return stristr($str, $find);
        }
    }

but i am not sure how to use it? where should i place it?

could any one help me regarding this? how to update this code to match regex and remove errors?

thanks..

  • 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-28T18:35:24+00:00Added an answer on May 28, 2026 at 6:35 pm

    As of PHP 5.3.0, the POSIX Regex extension is deprecated in favour of the PCRE extension.

    See http://php.net/reference.pcre.pattern.posix for a short overview on migrating your POSIX regex code (ereg*) to use the PCRE (preg_*) functions, necessary alterations to your regular expressions and limitations of both extensions.


    Also, you should not use the code that you found. The PHP error is stating that the function exists but is deprecated. The code that you found will do nothing to help.


    An example of a common “conversion” might look like:

    POSIX if (eregi('apple|pear')) …

    PCRE if (preg_match('/apple|pear/i')) …

    What was done?

    • Matching function changed from eregi() to preg_match().
    • Regular expression pattern delimiters were added.
    • Pattern modifier i (PCRE_CASELESS) was used (to match case-insensitively).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was using this code to download a pdf file from server but it
I am using this code: NSURLConnection *oConnection=[[NSURLConnection alloc] initWithRequest:oRequest delegate:self]; to download a file,
I am using This code to download a file private WebClient client; client =
I'm using this code to download the timeline page from our local Trac system:
I'm using this code for download files from a server via FTP. It works
I am using this code to download a package from server A and put
I'm using this code to download a dynamic image file which is already on
I'm using this PHP code on a file to open a dialog box to
When using this code (simplified for asking): var rows1 = (from t1 in db.TABLE1
I'm using this code from Microsoft to play audio notifications for my application. It's

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.