Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][CURL] Problem dane
zabolek
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 21.05.2010

Ostrzeżenie: (0%)
-----


Witam mam problem jak zrobic zeby sprawdzal czy istnieje dany kod np

<script>
sadsaddsa
</script>

a jak nie ma to aby pisal brak

napisalem takie cos i maly problem ;/

  1. $pageurl = "$domain";
  2. $ch = @curl_init($pageurl);
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  4.  
  5. curl_setopt ($ch, CURLOPT_URL, $pageurl );
  6. $html = curl_exec ( $ch );
  7. curl_close($ch);
  8.  
  9. //then you need to fix pathing to absolute
  10. $search = "<head>";
  11.  
  12. preg_match_all ( $search, $html, $a_matches );
  13. if($a_matches[1]=='')
  14. {
  15. echo 'Kod Znaleziono';
  16. }elseif($a_matches[0]) {
  17. echo 'Brak Kodu';
  18. }
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
zabolek
post
Post #2





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 21.05.2010

Ostrzeżenie: (0%)
-----


A jednak nie ;/

  1. $kod = '/<script type="text\/javascript">/';
  2. $kod.= '/asdas/';
  3. $kod.= '/<\/script>/';
  4. if (preg_match($kod, $html)) {
  5.  
  6. echo 'znaleziono';
  7.  
  8. } else {
  9.  
  10. echo 'nie znaleziono';
  11.  
  12. }


  1. Warning: preg_match() [function.preg-match]: Unknown modifier '/' in /home/site/public_html/include/functions.php on line 428
  2. nie znaleziono


Ten post edytował zabolek 21.05.2010, 09:59:34
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.12.2025 - 01:00