400 Bad Request when receiving a page with PHP Curl

I keep getting 400 error code from hotfile.com when I try to get it using curl.

  • I can get pages in a browser
  • The first (input) request (post) in the script works
  • The last request (get) in the for loop works
  • I tried setting the headers of the flourishes to the same headers sent by my browser.
  • I tried to sleep up to 5 seconds between requests, no difference

The problem is that all curl get requests in the for loop return the 400th request, with the exception of the last one, which is strange to me.

Here's a link to the script: http://pastie.org/627436 I use the Curl Sean Hubers shell: http://github.com/shuber/curl And also SimpleHMTLDOM: http://simplehtmldom.sourceforge.net/

It may be difficult for people to try if you do not have a hotfile account, since the script will not work with an unregistered account.

Greetings in advance :)

+3
source share
1 answer

My first guess would be changing

$urls = explode("\n",$_POST['urls']);   => $urls = explode("\r\n",$_POST['urls']);

(\n => \r\n)

, , , URL- http:\xyz.com\r . , URL- , , . , :)

+12

Source: https://habr.com/ru/post/1718382/


All Articles