정규식 질문

정규식 질문

QA

정규식 질문

본문

 

{"ret":0,"msg":"OK","channel_item":[{"streamprotocol":"HTTP","service_url":"http://1ab.xxxx.xx.co.kr/1tt-m/1tt-m_hd.m3u8?Expires=1611206278&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovLzF0di5nc2Nkbi5rYnMuY28ua3IvMXR2LW0vMXR2LW1faGQubTN1OCIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTYxMTIwNjI3OH19fV19&Signature=QUBneqUZpQ3xF6nsGzxTGJ7444x6DUcVfwNH~oPfblOs~WDfOquOftcHw2YkcFqXOmnpZp-nqhO0uqO0aGrhjy7j4PWgoyghXPlG3IdRtUA45bNqFev5XHi5~mwuub3UxKIS87-scDAVCM057T8RSFXvE4c2pVQlKnVwwWWthP9lknz9~foTDcLxdPC4Bw5OVlSjKxf51PhfsRUN~DhtMMBBwqZ9oP4aUs5E0BrWUhXx7DVBi0i5TpZHPeFDInM-s6n8rCQ6nxOJMuaWxdMJMd343w816izkYoRoV7Hh8pBzH7uR8sfwgQEYFe1uxWfPHR2XH2lcK3ZFuf68wp3Vig__&Key-Pair-Id=APKAICDSGT3Y7IXGJ3TA","nid":"51100000007190","screentype":"1tv","bitrate":"500Kbps","channel_code":"11"},
 
php 정규식표현 에서  http부분만 ( http://......Key-Pair-Id=APKAICDSGT3Y7IXGJ3TA )
정규식표현으로 할려면  어떻케 해야하나요?
 
 

 

 

이 질문에 댓글 쓰기 :

답변 2


<?php
$str = '{"ret":0,"msg":"OK","channel_item":[{"streamprotocol":"HTTP","service_url":"http://1ab.xxxx.xx.co.kr/1tt-m/1tt-m_hd.m3u8?Expires=1611206278&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovLzF0di5nc2Nkbi5rYnMuY28ua3IvMXR2LW0vMXR2LW1faGQubTN1OCIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTYxMTIwNjI3OH19fV19&Signature=QUBneqUZpQ3xF6nsGzxTGJ7444x6DUcVfwNH~oPfblOs~WDfOquOftcHw2YkcFqXOmnpZp-nqhO0uqO0aGrhjy7j4PWgoyghXPlG3IdRtUA45bNqFev5XHi5~mwuub3UxKIS87-scDAVCM057T8RSFXvE4c2pVQlKnVwwWWthP9lknz9~foTDcLxdPC4Bw5OVlSjKxf51PhfsRUN~DhtMMBBwqZ9oP4aUs5E0BrWUhXx7DVBi0i5TpZHPeFDInM-s6n8rCQ6nxOJMuaWxdMJMd343w816izkYoRoV7Hh8pBzH7uR8sfwgQEYFe1uxWfPHR2XH2lcK3ZFuf68wp3Vig__&Key-Pair-Id=APKAICDSGT3Y7IXGJ3TA","nid":"51100000007190","screentype":"1tv","bitrate":"500Kbps","channel_code":"11"},';
preg_match('%(http[^"]+)%i', $str, $matches);
print_r($matches);
답변을 작성하시기 전에 로그인 해주세요.
전체 1,178
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT