HTTP Authentication with PHP
Http://www.vividchanelhandbags.com/images/20000665.jpg This image HTTP authentication to open. Write a function to download the picture. Know the Verified account number and password
Test 123789 how to do it. How to pass the account password through the function? Master Help.
------Solution--------------------
It's called garbled, huh?
PHP Code
$url = "Http://www.vividchanelhandbags.com/images/20000665.jpg"; $ch = Curl_init ($url); $useragent = "mozilla/4.0 ( Compatible MSIE 6.0; Windows NT 5.1; SV1) "; $header = Array (' ACCEPT-LANGUAGE:ZH-CN ', ' connection:keep-alive ', ' Cache-control:no-cache '); Header information curl_setopt ($ch, Curlopt_httpheader, $header); User_agent curl_setopt ($ch, curlopt_useragent, $useragent); curl_setopt ($ch, Curlopt_userpwd, "test:123789"); $response = Curl_exec ($ch);//You get the binary content of the picture, to display the picture, you have to tell the browser, The content format is what header ("content-type:image/jpg"); Echo $response;
------Solution--------------------
PHP Code