HTTP/1.1 505 HTTP Version Not Supported

前端 未结 2 1839
离开以前
离开以前 2021-02-20 17:37

I\'m running a PHP script to grab a web page. It worked fine with many sites, but with one site it fails, returning an error saying \"HTTP/1.1 505 HTTP Version Not Supported\".<

相关标签:
2条回答
  • 2021-02-20 17:48

    I see you're using a space in your URL. That won't work To solve the problem I would put the url in another variable and encode it like so:

    $URL = urlencode("http://www.lovelybooks.de/stoebern/empfehlung/romantic fantasy/?seite=".$i);
    
    file_get_contents($URL);
    
    0 讨论(0)
  • 2021-02-20 18:10

    Replace the space in the URL with its percent-encoding:

        $page = file_get_contents("http://www.lovelybooks.de/stoebern/empfehlung/romantic%20fantasy/?seite=$i");
    
    0 讨论(0)
提交回复
热议问题