movid Posted August 9, 2016 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; ?>
Krydos Posted August 9, 2016 Posted August 9, 2016 It looks like it's timing out. Are you using file_get_contents() or curl on that test?
movid Posted August 9, 2016 Author Posted August 9, 2016 Yes I use two functions in heliohost, if I replace the link with youtube, works fine
Krydos Posted August 9, 2016 Posted August 9, 2016 Are you using file_get_contents() or curl on that test?
Krydos Posted August 9, 2016 Posted August 9, 2016 http://www.movid.gq/test.php uses both curl and get_file_contents?
wolstech Posted August 9, 2016 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.
Krydos Posted August 9, 2016 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...
movid Posted August 9, 2016 Author Posted August 9, 2016 I thought so before, if SoundCloud blocked , so now it can no longer or can unblock it back?
Krydos Posted August 9, 2016 Posted August 9, 2016 As soon as I unblocked that IP address the script works now: http://www.movid.gq/test.php
wolstech Posted August 9, 2016 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now