Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7960747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:50:35+00:00 2026-06-04T04:50:35+00:00

I have this code I have written to make my life easier when downloading

  • 0

I have this code I have written to make my life easier when downloading .torrents, the code is as follows,

$file = 'http://kat.ph/new/';
if($file = file_get_contents($file)) {
    // RETURN ALL MAGNET URIS FROM FILE
    preg_match_all('/\"magnet\:\?xt\=urn\:btih\:(.*?)\"/x', $file, $magnetURI);
    // FOR EACH MAGNET URI RETURNED
    foreach($magnetURI[1] as $info) {
        echo '<a href="magnet:?xt=urn:btih:' . $info . '">' . $info . '</a><br /><br /><br /><br />';
    }
} else {
    echo '<strong>FAIL</strong>';
}

It is supposed to match magnet uri links and return them to me in easy to click links, it works on other websites try replacing the file with http://thepiratebay.se/recent/0, but for some reason the website in the example it will not work on?!?

Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:50:36+00:00Added an answer on June 4, 2026 at 4:50 am

    It works for me, try removing the x modifier.


    The problem is the file_get_contents() call, apparently kat.ph doesn’t like anonymous user agents, if you try to output the $file variable you get a bunch of garbage like:

    ��}�r�Ʋ�o�)&\ˑ\@�Aڒ�I���X���8Y;�r �!    �Ĭ���� ϓ����.   ��ey�ĥg�랾��;�u޻��:��Q6����9�Q�[e��E�~vv��J��Z�٬��=5��n-̒>Ũc�Q�O���ip�[s�(cQ&�&�F<�m������T^oD��e��l 7j���e��]K�K�ţ�ݚ�R/ &YG���x��|��gQS�D��dq�����~�ӌ�32�2HS8�,�B��)z��x'4M�S;uq�ӝ0�NH���Z��OG�e5����Q���zhd4<ŋ�u����Ug��o+�� �H�b�8ɼiFY��f0�C���oR��e*t2��x���Մ.߭L�����,�H��7]��Q�q=1fW�   ��"?�!�{O/5��f��IH����[�DO�8Y#i�]i�S�5�R>�,=��SG��_�G��4o�,4�X�XcS� 36����wl�Vr�0D�_I�Ì%�X�*s�Q��$M�s4r| �֎�}$�g`+���0�c#7�'4S&�:|�~� ��$��S�d���y�����8 ��u{���M=P㩑����[oN����?��h`�/ћ}����R|�A � z;�0(�(���Q����=�8���>І[�ㆻF,��]��M����6!��=a4GW�+o���z��o۩s�s    ]�0��H�b�����#�/d��Z�/ԕߌ6�P�|�gE�V���dz�ćz���|�zl�ɗ�)��i���e�$�/"��l�ʟ�) ���K�ʗx��Ʉ��:9'H�$�2�ؓP�,�r/��+Fcmq]�P|���n 
    

    Try setting the user agent to a known browser (via file_get_contents() HTTP context or CURL).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this code to make a binary file of float numbers, but
I have written this code in javascript however I have to make it work
I have written the following class to make life easier for me: import pymssql
I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2: smtpClient.Send(mailMsg);
I have written this code to join ArrayList elements: Can it be optimized more?
I have written this code to convert string in such format 0(532) 222 22
I have this code in my ASP.NET application written in C# that is trying
In my code I have written this but it fails to compile: In Class1.h:
Hi I have written code like this @Id @Column(nullable=false) @GeneratedValue(strategy=GenerationType.AUTO) public int getUserID() {
In our application, I have seen code written like this: User.java (User entity) public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.