"일꾼이 일을 잘하려면 먼저 도구를 갈고 닦아야 한다." - 공자, 『논어』.
첫 장 > 프로그램 작성 > PHP의 소스 URL에서 REDIRECT URL을 검색하는 방법은 무엇입니까?

PHP의 소스 URL에서 REDIRECT URL을 검색하는 방법은 무엇입니까?

2025-02-06에 게시되었습니다
검색:712

How to Retrieve Redirect URL from Source URL in PHP?

php에서 소스 URL에서 리디렉션 URL 검색

source url :

http://libero-news.it.feedsportal.com/c/34068/f/618095 /s/2e34796f/l/0l0sliberoquotidiano0bit0cnews0cnews0c12735670ci0esagggi0eper0eper0eriforme0ecostituzionali0echiaccherano0ee0ee0ee0eescoltano0bhtml/story01.ht /&&&&&ch실 ;&&&&&ch실. &&&]

http://www.liberoquotidiano.it/news/1273567/i-saggi -ER-LEIFORME-COSTITUZINALI-Chiaccherano-e-ascoltano.html

http://libero-news.it.feedsportal.com/c/34068/f/618095/s/2e34796f/l/0L0Sliberoquotidiano0Bit0Cnews0C12735670CI0Esaggi0Eper0Ele0Eriforme0Ecostituzionali0EChiaccherano0Ee0Eascoltano0Bhtml/story01.htm

http://www.liberoquotidiano.it/news/1273567/I-saggi-per-le-riforme-costituzionali-Chiaccherano-e-ascoltano.html

$ url = "http://libero-news.it.feedsportal.com/c/34068/f/618095/s/2e34796f/l /0L0SLIBEROQUOTIDIANO0BIT0CNEWS0C12735670CI0ESAGGI0EPER0ELE0ERIFORTE0ECISTITUZIONALI0ECHIACCHEARONE0EE0EE0EESCOLTANO0BHTML/STORE01.HTM "; $ ch = curl_init (); curl_setopt ($ ch, curlopt_url, $ url); curl_setopt ($ ch, curlopt_header, true); curl_setopt ($ ch, curlopt_folloclocation, true); curl_setopt ($ ch, curlopt_returntransfer, true); $ a = curl_exec ($ ch); $ finalUrl = curl_getInfo ($ ch, curlinfo_effective_url); echo $ finalUrl; // 출력 : http://www.liberoquotidiano.it/news/1273567/i-saggi-per-le-costituzionali-chiaccherano-e-ascoltano.html;cin이 코드, 우리 : [우리 :

컬 핸들을 초기화하고 소스 URL을 요청 대상으로 설정하십시오.

$url = "http://libero-news.it.feedsportal.com/c/34068/f/618095/s/2e34796f/l/0L0Sliberoquotidiano0Bit0Cnews0C12735670CI0Esaggi0Eper0Ele0Eriforme0Ecostituzionali0EChiaccherano0Ee0Eascoltano0Bhtml/story01.htm";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

$a = curl_exec($ch);

$finalUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); 

echo $finalUrl; // Output: http://www.liberoquotidiano.it/news/1273567/I-saggi-per-le-riforme-costituzionali-Chiaccherano-e-ascoltano.html
curlopt_followlocation을 true로 설정하여 다음 리디렉션을 허용합니다.

curlopt_returntransfer를 통해 문자열로 응답을 반환합니다.
    이 단계를 따르면 주어진 소스 URL에서 리디렉션 URL을 성공적으로 검색 할 수 있습니다.
릴리스 선언문 이 기사는 다음과 같이 재현됩니다.
최신 튜토리얼 더>

부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.

Copyright© 2022 湘ICP备2022001581号-3