2

I'm currently struggeling to get the page content of a tumblr post. Thats how my script looks like:

    $c = curl_init($url);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($c, CURLOPT_ENCODING ,"");
    curl_setopt($c, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)');
    curl_setopt($c, CURLOPT_REFERER, $url);

    curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($c, CURLOPT_MAXREDIRS, 2);
    curl_setopt($c, CURLOPT_HEADER, true);

    $html = curl_exec($c);

    print_r(curl_getinfo($c));
    curl_close($c);

There is no problem fetching a whole "tumblr", for example http://anyuser.tumblr.com.

But when I try to get something like http://anyuser.tumblr.com/post/1234567890/my-post, the server responds with 400 (bad request). Where is the problem? I found several solutions for posting data on tumblr via curl, but it seems like nobody had this kind of problem before.

Daniello
  • 175
  • 14
  • 1
    I just tried your code and it works fine here, using the top post of anyuser.tumblr.com. Try enabling verbose mode for more information, see https://stackoverflow.com/q/3757071/3794472 – Jeremiah Winsley Jul 31 '15 at 13:52

0 Answers0