Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
PHP Find specific domain link in string

I need to find a url in text starts with domain zippyshare and put it in the var. I know that i must use regular expression but i don't have idea to make it. Lets say that we have 3 links in text

Facebook: https://facebook.com/pumpsquadofficial Instagram: https://instagram.com/pump_squadpl DOWNLOAD MP3: http://www42.zippyshare.com/v/d6LnGjH8/file.html

and i need to find and put this link "www.42.zippyshare.com/v/blahblahblah" into <a href="$link">. Do you have any idea how to make it? Sorry for my english.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your question is pretty vague... Obviously you can extract the link looking for that domain name:

<?php
$data = <<<LINKS
Facebook: https://facebook.com/pumpsquadofficial Instagram: https://instagram.com/pump_squadpl DOWNLOAD MP3: http://www42.zippyshare.com/v/d6LnGjH8/file.html Some more text
LINKS;
preg_match('~(http://\w+\.zippyshare\.com/[^\s]+)~', $data, $tokens);
echo sprintf('<a href="%s">', $tokens[1]);

The output obviously is:

<a href="http://www42.zippyshare.com/v/d6LnGjH8/file.html">

I think however it makes sense to invest a few moments into the definition of what information you actually can rely on to extract that link. Is the domain really always that zippyshare.com? Or maybe you need to always extract the link following the DOWNLOAD MP3?

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda