movid Posted August 9, 2016 Share Posted August 9, 2016 Why every time I use file_get_contents and curl to url SoundCloud always display an error or a blank page . Check my code : <?php $grab = file_get_contents("http://api.soundcloud.com/tracks?q=Adventure&limit=5&client_id=7fda73e4303db4146b1b2145944d3e1c");echo $grab; ?> Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 What error? Quote Link to comment Share on other sites More sharing options...
movid Posted August 9, 2016 Author Share Posted August 9, 2016 Check this http://www.movid.gq/test.php Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 It looks like it's timing out. Are you using file_get_contents() or curl on that test? Quote Link to comment Share on other sites More sharing options...
movid Posted August 9, 2016 Author Share Posted August 9, 2016 Yes I use two functions in heliohost, if I replace the link with youtube, works fine Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 Are you using file_get_contents() or curl on that test? Quote Link to comment Share on other sites More sharing options...
movid Posted August 9, 2016 Author Share Posted August 9, 2016 Yes i use it I actually use both Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 http://www.movid.gq/test.php uses both curl and get_file_contents? Quote Link to comment Share on other sites More sharing options...
wolstech Posted August 9, 2016 Share Posted August 9, 2016 Stevie is blocked by Soundcloud: rax@rax.heliohost.org [~]# wget -O=sc.tmp "http://api.soundcloud.com/tracks?q=Adventure\&limit=5\&client_id=7fda73e4303db4146b1b2145944d3e1c" --2016-08-09 09:16:29-- http://api.soundcloud.com/tracks?q=Adventure&limit=5&client_id=7fda73e4303db4146b1b2145944d3e1c Resolving api.soundcloud.com... 72.21.91.127 Connecting to api.soundcloud.com|72.21.91.127|:80... It never connects, sits for several minutes then times out. On a local server of mine: root@acmine:~# wget -O=sc.tmp http://api.soundcloud.com/tracks?q=Adventure\&limit=5\&client_id=7fda73e4303db4146b1b2145944d3e1c --2016-08-09 12:21:01-- http://api.soundcloud.com/tracks?q=Adventure&limit=5&client_id=7fda73e4303db4146b1b2145944d3e1c Resolving api.soundcloud.com (api.soundcloud.com)... 72.21.91.127 Connecting to api.soundcloud.com (api.soundcloud.com)|72.21.91.127|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9383 (9.2K) [application/json] Saving to: `=sc.tmp' 100%[===================================================================================================================>] 9,383 --.-K/s in 0.001s 2016-08-09 12:21:02 (7.76 MB/s) - `=sc.tmp' saved [9383/9383] root@acmine:~# Looks good. That sc.tmp contains a JSON result. Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 On the command line you need to escape your ampersands like this http://api.soundcloud.com/tracks?q=Adventure\&limit=5\&client_id=7fda73e4303db4146b1b2145944d3e1c Otherwise it breaks the command up and tries to run it in the background etc. Resolving api.soundcloud.com... 72.21.91.127Connecting to api.soundcloud.com|72.21.91.127|:80...So, here's the problem: 72.21.91.127 # DOS 42 connections - Thu Jul 28 13:17:47 2016 Soundcloud doesn't have us blocked. We have them blocked... Quote Link to comment Share on other sites More sharing options...
movid Posted August 9, 2016 Author Share Posted August 9, 2016 I thought so before, if SoundCloud blocked , so now it can no longer or can unblock it back? Quote Link to comment Share on other sites More sharing options...
Krydos Posted August 9, 2016 Share Posted August 9, 2016 As soon as I unblocked that IP address the script works now: http://www.movid.gq/test.php Quote Link to comment Share on other sites More sharing options...
wolstech Posted August 9, 2016 Share Posted August 9, 2016 Yeah, I realized that after I posted it when I looked closer and realized it chopped most of the arguments off. Re-ran and post edited. Quote Link to comment Share on other sites More sharing options...
movid Posted August 9, 2016 Author Share Posted August 9, 2016 Thanks Krydos and Wolstech Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.