php - Need assistance cURL'ing a link -



php - Need assistance cURL'ing a link -

i trying curl next link: http://soundstreamradio.serverroom.net:7424/currentsong?sid=1

it's page displays plain text. curl php code i'm using:

function get_web_page( $url ) { $user_agent='mozilla/5.0 (windows nt 6.1; rv:8.0) gecko/20100101 firefox/8.0'; $options = array( curlopt_customrequest =>"get", //set request type post or curlopt_post =>false, //set curlopt_useragent => $user_agent, //set user agent curlopt_cookiefile =>"cookie.txt", //set cookie file curlopt_cookiejar =>"cookie.txt", //set cookie jar curlopt_returntransfer => true, // homecoming web page curlopt_header => false, // don't homecoming headers curlopt_followlocation => true, // follow redirects curlopt_encoding => "", // handle encodings curlopt_autoreferer => true, // set referer on redirect curlopt_connecttimeout => 120, // timeout on connect curlopt_timeout => 120, // timeout on response curlopt_maxredirs => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; homecoming $header; }

and i'm using phone call script:

$result = get_web_page("http://soundstreamradio.serverroom.net:7424/index.html?sid=1"); if ( $result['errno'] != 0 ) echo "... error: bad url, timeout, redirect loop ..."; if ( $result['http_code'] != 200 ) echo"... error: no page, no permissions, no service ..."; $page = $result['content'];

now after uploading server , running it, page hangs , nothing, after 120 seconds times out displaying of error messages (... error: bad url, timeout, redirect loop ..., ... error: no page, no permissions, no service ...)

i'm looking see if there options can take pull info off of website without cross domain issues.

try

echo file_get_contents("http://soundstreamradio.serverroom.net:7424/currentsong?sid=1");

use curl_exec , other functions https connections

php html curl

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -