use curl to download indirect image file

前端 未结 1 1181
温柔的废话
温柔的废话 2021-01-15 15:45

I am try to download image files from url from the following code, but it doesn\'t return the right content from the server. The image can be rendered in browser by loading

1条回答
  •  半阙折子戏
    2021-01-15 16:35

    why not just use file_get_contents like this

    $img = file_get_contents("http://count.koubei.com/showphone/showphone.php?f=jpg&w=104&h=10&bc=255,255,255&fc=0,0,0&fs=10&fn=arial&phone=LTIxMDM3MjIyOTc%3D%23dWBzmKEZpTh7YcWvOw%3D%3D");
    file_put_contents("photo.jpg",$img);
    

    0 讨论(0)
提交回复
热议问题