Ir para conteúdo
mldiogo87

Preg_match, simplificar o código e corrigir bug.

Recommended Posts

Boa tarde!

É a última parte para terminar minha página. Se poder ajudar, eu lhes agradeço.

Seguinte, eu tenho um campo texto no mysql que contém uma notícia.

Em determinado local da notícia, eu uso tipo um "bbcode" para puxar textos de outra tabela no sql. 

Exemplo.

OI MEU NOME É DIOGO.

NOTÍCIA BLABLABLA.

<rlta>chamaoutranotícia</rlta>

continua notícia etc etc.

 

Então, em tese, seria só usar o 

if(preg_match("@<rlta>(.*?)</rlta>@si", $texto14, $matches)){
 
$sql3 = "SELECT * FROM relatosad Where assunto = '$matches[1]'";


$resultado3 = mysql_query($sql3)
or die ("Não foi possível realizar a consulta ao banco de dados");


while ($linha3=mysql_fetch_array($resultado3)) {

$textoa = $linha3["textoa"];
$texto14 = str_replace($matches[1], ''.$textoa.'', $texto14);


}
} else { 
echo 'Algo deu errado';
} 

Para extrair a parte entre os <rlta></rlta> e realizar a consulta no banco de dados com isso...O script funcionou de certa forma, o problema é que se eu chamar mais de 1 notícia, utilizando esse procedimento, o código não irá funcionar, porque estou usando a sting fixa ($matches[1]) sem qualquer while, além disso esse código está me cheirando gambiarra....Sabe?

Alguém teria alguma dica pra eu pesquisar pra simplificar isso ?

Pensei em gerar .txt das notícias e usar simples include durante a notícia. O que vcs sugerem ? Grato

Compartilhar este post


Link para o post
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora

  • Conteúdo Similar

    • Por Dr. Programador
      Boa tarde pessoal!
       
      Estou querendo que seja somente aceito:  letras, números, pontos, hifens e sublinhados(underline).
      E também não quero que aceite @site.com.br caso ele digite.
       
      Estou tendo utilizar a função abaixo, porém não tenho ideia como mexer na expressão regular:
      function validaEmail($mail) { if(preg_match("/^([[:alnum:]_.-]){3,}([[:lower:][:digit:]_.-]{3,})(.[[:lower:]]{2,3})(.[[:lower:]]{2})?$/", $mail)) { return 'Correto!'; } else { return 'Errado!'; } } $cliente_email = 'contato.cliente'; echo validaEmail($cliente_email);  
      Alguém poderia me ajudar nesta validação?
       
      Desde já agradeço!
    • Por Wesley Inacio
      Olá, estou com um problema em meu novo projeto.
       
      Baixei uma class para baixar um vídeo do YouTube, esta classe, gera 5 links para download em 5 qualidades diferentes (5 tags em mp4), porém, esta parte do preg_match, só trás os 5 primeiros links nas qualidades 22, 18, 59, 43 e 17, eu queria que ele trouxesse também a qualidade 140 (e entre outras) que são de áudio.
       
      Este é o preg_match que está retornando até a 5º qualidade:
       
      if(preg_match('@url_encoded_fmt_stream_map["\']:\s*["\']([^"\'\s]*)@', $html, $matches)){ ($html = Todo o html do vídeo na página do YouTube com o script que gera em todas qualidades)
      ($matches = Array abaixo, já retornando apenas com 5 tags de qualidade diferentes, eu queria mais tags)
      Ele retorna:
      array ( 0 => 'url_encoded_fmt_stream_map":"sp=signature\\u0026quality=hd720\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26requiressl%3Dyes%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26ipbits%3D0%26fvip%3D1%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ip%3D201.75.228.145%26mt%3D1525617522%26lmt%3D1524616680905595%26fexp%3D23724337%26sparams%3Ddur%252Cei%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ%26itag%3D22\\u0026itag=22\\u0026s=FCFC7FC76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD71A86411149424EF2EACD8D8\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D0.000%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fwebm%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524619514746879%26itag%3D43%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D22386160%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=43\\u0026s=BFBF9BF9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E77647A0F4354CEFBDCDCCD9C9C\\u0026type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524616369334936%26itag%3D18%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D18471872%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=18\\u0026s=8C8C78C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD734343\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.42001E%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613263245690%26itag%3D36%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D5695363%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=36\\u0026s=6F6F06F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA21C59A5C2894FFC8364B6B6\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613259315388%26itag%3D17%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D2025409%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=17\\u0026s=B2B2CB2C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E65F7F87B08866182488B1616\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22', 1 => 'sp=signature\\u0026quality=hd720\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26requiressl%3Dyes%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26ipbits%3D0%26fvip%3D1%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ip%3D201.75.228.145%26mt%3D1525617522%26lmt%3D1524616680905595%26fexp%3D23724337%26sparams%3Ddur%252Cei%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ%26itag%3D22\\u0026itag=22\\u0026s=FCFC7FC76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD71A86411149424EF2EACD8D8\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D0.000%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fwebm%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524619514746879%26itag%3D43%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D22386160%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=43\\u0026s=BFBF9BF9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E77647A0F4354CEFBDCDCCD9C9C\\u0026type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524616369334936%26itag%3D18%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D18471872%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=18\\u0026s=8C8C78C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD734343\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.42001E%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613263245690%26itag%3D36%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D5695363%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=36\\u0026s=6F6F06F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA21C59A5C2894FFC8364B6B6\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613259315388%26itag%3D17%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D2025409%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=17\\u0026s=B2B2CB2C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E65F7F87B08866182488B1616\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22', ) E no final, tenho esses 5 links de 5 qualidades diferentes:
       
      array ( 22 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.773&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&mv=m&ms=au%2Crdu&mm=31%2C29&requiressl=yes&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&ipbits=0&fvip=1&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&expire=1525639262&mime=video%2Fmp4&key=yt6&ip=201.75.228.145&mt=1525617522&lmt=1524616680905595&fexp=23724337&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&itag=22&signature=1C76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD7FA86411149424EF2EACD8', 'format' => 'MP4 720p (HD)', ), 43 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=0.000&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2Fwebm&key=yt6&ipbits=0&lmt=1524619514746879&itag=43&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=22386160&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=4F9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E776B7A0F4354CEFBDCDCCD9C', 'format' => 'WebM 360p', ), 18 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.773&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2Fmp4&key=yt6&ipbits=0&lmt=1524616369334936&itag=18&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=18471872&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=8C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD7343', 'format' => 'MP4 360p', ), 36 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.796&initcwndbps=396250&pl=21&source=youtube&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2F3gpp&key=yt6&ipbits=0&lmt=1524613263245690&itag=36&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=5695363&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=2F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA61C59A5C2894FFC8364B6', 'format' => 'Unknown', ), 17 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.796&initcwndbps=396250&pl=21&source=youtube&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2F3gpp&key=yt6&ipbits=0&lmt=1524613259315388&itag=17&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=2025409&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=52C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E6BF7F87B08866182488B16', 'format' => '3GP 144p', ), ) Alguém poderia me ajudar? Obrigado.
    • Por Ze Fernando
      Boa noite amigos
      Escrevo desde Portugal para solicitar ajuda para um problema.
      Eu aproveitei um template já feito, para fazer um site, mas depois de fazer as respetivas alterações ao formulário e testá-lo no browser aconteceu o seguinte:
      Após enviar o formulário surgiu a mensagem de "ENVIADO", mas também apareceu outra mensagem no mesmo quadro que dizia o seguinte:           Warning: preg_match(): Empty regular expression in /home/fojox102/public_html/contact.php on line 113
            2. Em uma parte do código PHP estava !eregi ..... e a mensagem dava erro dizendo que "eregi" estava desatualizado e encontrei na NET alguém dizendo que se alterasse para preg_match o problem ficava resolvido, mas não ficou, no entanto eu mantive "preg_match".
      Eu envio o código da página "contato.php". Também podem fazer o teste acedendo a http://fojo.x10host.com/contact.php.
      Será que algum de vocês me pode ajudar a solucionar o problema?
      Os meus agradecimentos
      José Moreira
      <!DOCTYPE HTML> <html> <head> <title>Fojo's Runners</title> <meta name="description" content="website description" /> <meta name="keywords" content="website keywords, website keywords" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <!-- modernizr enables HTML5 elements and feature detects --> <script type="text/javascript" src="js/modernizr-1.5.min.js"></script> </head> <body> <div id="bg"> <img src="images/background.jpg" alt="home"> </div> <div id="main"> <header> <div id="logo"> <div id="logo_text"> <!-- class="logo_colour", allows you to change the colour of the text --> <h1><a href="index.html">FOJO'S <span class="logo_colour"> RUNNERS</span></a></h1> <h2>Amigos do Treino e doidos por Trail's.</h2> </div> </div> <nav> <div id="menu_container"> <ul class="sf-menu" id="nav"> <li><a href="index.html">Home</a></li> <li><a href="about.html">Quem somos</a></li> <li><a href="corridas.html">Corridas</a></li> <li><a href="#">Nutrição</a> <ul> <li><a href="amatinal.html">Antes treino matinal</a></li> <li><a href="dmatinal.html">Após treino matinal</a></li> <li><a href="atarde.html">Antes treino da tarde</a></li> <li><a href="dtarde.html">Após treino da tarde</a></li> <li><a href="outros.html">Outros dias</a></li> </ul> </li> <li><a href="roupa.html">Vestuário</a></li> <li><a href="#">Treinar</a> <ul> <li><a href="casa.html">Em casa</a></li> <li><a href="chuva.html">Com chuva</a></li> <li><a href="bomtempo.html">Bom tempo</a></li> <li><a href="frio.html">Frio ou geada</a></li> <li><a href="verao.html">Treinar no Verão</a></li> </ul> </li> <li><a href="contact.php">Contacto</a></li> </ul> </div> </nav> </header> <div id="site_content"> <div id="sidebar_container"> <div class="sidebar"> <h3>Latest News</h3> <h4>New Website Launched</h4> <h5>December 1st, 2013</h5> <p>2013 sees the redesign of our website. <a href="#">Read more</a></p> </div> <div class="sidebar"> <h3>Useful Links</h3> <ul> <li><a href="#">First Link</a></li> <li><a href="#">Another Link</a></li> <li><a href="#">And Another</a></li> <li><a href="#">Last One</a></li> </ul> </div> <div class="sidebar"> <h3>More Useful Links</h3> <ul> <li><a href="#">First Link</a></li> <li><a href="#">Another Link</a></li> <li><a href="#">And Another</a></li> <li><a href="#">Last One</a></li> </ul> </div> </div> <div class="content"> <h1>Formulário de contacto</h1> <p>Fala connosco utilizando este formulário.</p> <p>Aproveita para tirares dúvidas, apresentares as tuas ideias, enviares informação que consideres de interesse para os amantes do Trail Running ou simplesmente para propores uma corrida ou treino por aí.</p> <?php // Set-up these 3 parameters // 1. Enter the email address you would like the enquiry sent to // 2. Enter the subject of the email you will receive, when someone contacts you // 3. Enter the text that you would like the user to see once they submit the contact form $to = 'fojo.runners@gmail.com'; $subject = 'Mensagem de Fojo Runners'; $contact_submitted = 'A tua mensagem foi enviada com sucesso.'; // Do not amend anything below here, unless you know PHP function email_is_valid($email) { return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email); } if (!email_is_valid($to)) { echo '<p style="color: red;">Deves configurar um endereço de e-mail válido para que possas enviar a mensagem.</p>'; } if (isset($_POST['contact_submitted'])) { $return = "\r"; $youremail = trim(htmlspecialchars($_POST['your_email'])); $yourname = stripslashes(strip_tags($_POST['your_name'])); $yourmessage = stripslashes(strip_tags($_POST['your_message'])); $contact_name = "Name: ".$yourname; $message_text = "Message: ".$yourmessage; $user_answer = trim(htmlspecialchars($_POST['user_answer'])); $answer = trim(htmlspecialchars($_POST['answer'])); $message = $contact_name . $return . $message_text; $headers = "From: ".$youremail; if (email_is_valid($youremail) && !preg_match("\r",$youremail) && !preg_match("\n",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) { mail($to,$subject,$message,$headers); $yourname = ''; $youremail = ''; $yourmessage = ''; echo '<p style="color: blue;">'.$contact_submitted.'</p>'; } else echo '<p style="color: red;">Por favor, digita o teu nome, um endereço de e-mail válido, a mensagem e a resposta a uma simples pergunta de matemática antes de enviares a mensagem..</p>'; } $number_1 = rand(1, 9); $number_2 = rand(1, 9); $answer = substr(md5($number_1+$number_2),5,10); ?> <form id="contact" action="contact.php" method="post"> <div class="form_settings"> <p><span>Name</span><input class="contact" type="text" name="your_name" value="<?php echo $yourname; ?>" /></p> <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="<?php echo $youremail; ?>" /></p> <p><span>Message</span><textarea class="contact textarea" rows="5" cols="50" name="your_message"><?php echo $yourmessage; ?></textarea></p> <p style="line-height: 1.7em;">To help prevent spam, please enter the answer to this question:</p> <p><span><?php echo $number_1; ?> + <?php echo $number_2; ?> = ?</span><input type="text" name="user_answer" /><input type="hidden" name="answer" value="<?php echo $answer; ?>" /></p> <p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="Enviar" /></p> </div> </form> </div> </div> <div id="scroll"> <a title="Scroll to the top" class="top" href="#"><img src="images/top.png" alt="top" /></a> </div> <footer> <p><a href="index.html">Home</a> | <a href="about.html">Quem somos</a> | <a href="corridas.html">Corridas</a> | <a href="vestuario.html">Vestuário</a> | <a href="contact.php">Contacto</a></p> <p>Copyright &copy; fojo's runners 2018 | <a href="http://www.css3templates.co.uk">design from css3templates.co.uk</a></p> </footer> </div> <!-- javascript at the bottom for fast page loading --> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.easing-sooper.js"></script> <script type="text/javascript" src="js/jquery.sooperfish.js"></script> <script type="text/javascript"> $(document).ready(function() { $('ul.sf-menu').sooperfish(); $('.top').click(function() {$('html, body').animate({scrollTop:0}, 'fast'); return false;}); }); </script> </body> </html>  
    • Por joaoooo
      Olá.
      Eu tenho o seguinte código:
      {# css-modules="/catalogue/section" #} <section class="breadcrumb"> <ul class="breadcrumb-containner"> {% for item in breadcumb %} <li class="item"> <a href="{{ item['link'] }}">{{ item['name'] }} </a> </li> <li class="item separator"> > </li> {% endfor %} <li class="item"> <a href="{{ section.link }}">{{section.name}} </a> </li> </ul> </section>  
      E queria usar PHP para "buscar" o valor de "css-modules"
       
    • Por Bruno Gama
      Site de onde quero pegar os dados

      Eu preciso utilizar preg_match_all para pegar o que está dentro de
      <table class="grid-table survey-info" cellspacing="0"> Por enquanto fiz o seguinte
       
      <?php $url = 'http://metadados.capes.gov.br/index.php/catalog/100'; $dadosSite = file_get_contents($url); preg_match_all('/(O que falta)/', $dadosSite, $conteudo); $echo conteudo[0][0]; ?>  
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.