Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 07-05-2009, 05:25 AM   #1
Active Warrior
 
Join Date: Jun 2009
Posts: 36
Thanks: 2
Thanked 0 Times in 0 Posts
Default Why i Canot make curl of this url?

Quote:
////////////////// i has try to use file_get_conetents////////
<?
$test = "http://220.181.23.202/s1/rpxiBVe6lybzimWQ/cdceabe1e4f1f901fb677c2ce64fb950/1246778125/v4/2006/mv/200750/11719752251z5ok.flv?ref=out";

$res = file_get_contents($test);

echo $res;
?>
//////////////////// and i use curl here ////////////////////

<?

function get($url1){
if(!isset($timeout))
$timeout=30;
$curl = curl_init();
if(strstr($referer,"://")){
curl_setopt ($curl, CURLOPT_REFERER, $referer);
}
curl_setopt ($curl, CURLOPT_URL, $url1);
curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5)));
curl_setopt ($curl, CURLOPT_HEADER, (int)$header);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);

$res = curl_exec($curl);

curl_close($curl);
return $res;
}

$test = "http://220.181.23.202/s1/rpxiBVe6lybzimWQ/cdceabe1e4f1f901fb677c2ce64fb950/1246778125/v4/2006/mv/200750/11719752251z5ok.flv?ref=out";

$content = get($test);
echo $content;
?>
////////////////////////////and i use fopen////////////////////

<?
$test = "http://220.181.23.202/s1/rpxiBVe6lybzimWQ/cdceabe1e4f1f901fb677c2ce64fb950/1246778125/v4/2006/mv/200750/11719752251z5ok.flv?ref=out";


$handle = fopen("$test", "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);


echo $contents;


?>
please can someone tell me what must i do to grab the contents
hotscode is offline   Reply With Quote
Old 07-05-2009, 07:57 AM   #2
phpLD master
War Room Member
 
dvduval's Avatar
 
Join Date: Dec 2006
Location: Silicon Valley
Posts: 2,962
Blog Entries: 3
Thanks: 44
Thanked 307 Times in 259 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile  View Member's YouTube Profile
Default Re: Why i Canot make curl of this url?

Have you checked with your host to make sure they allow curl of external urls?

PHP Link Directory Script - a great addition to ANY website and much more than just a directory.
templates for phpLD - phpLD Templates (hundreds!)
Article Directory Script - Video Directory Script
Get our Product Free - Through this exclusive WSO!!!
dvduval is offline   Reply With Quote
Old 07-05-2009, 09:33 AM   #3
Gary
 
GB2008's Avatar
 
Join Date: Jan 2009
Location: Dallas, TX
Posts: 135
Blog Entries: 1
Thanks: 13
Thanked 9 Times in 9 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to GB2008
Default Re: Why i Canot make curl of this url?

That was my first thought too - my host caught me on this - especially on a shared hosting plan, they often block outgoing connections from your server. Blocks RSS feed reading scripts, CURL - anything like that. Check with them first - they can usually create an exception for just your script to connect out.

GB2008 is offline   Reply With Quote
Old 07-05-2009, 11:57 PM   #4
Active Warrior
 
Join Date: Jun 2009
Posts: 36
Thanks: 2
Thanked 0 Times in 0 Posts
Default Re: Why i Canot make curl of this url?

Quote:
Originally Posted by GB2008 View Post
That was my first thought too - my host caught me on this - especially on a shared hosting plan, they often block outgoing connections from your server. Blocks RSS feed reading scripts, CURL - anything like that. Check with them first - they can usually create an exception for just your script to connect out.
thanks for reply.

your right . my host blocking curl from that url . what can i do for get the content. can i use proxy.
hotscode is offline   Reply With Quote
Old 07-06-2009, 05:42 AM   #5
Gary
 
GB2008's Avatar
 
Join Date: Jan 2009
Location: Dallas, TX
Posts: 135
Blog Entries: 1
Thanks: 13
Thanked 9 Times in 9 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to GB2008
Default Re: Why i Canot make curl of this url?

Sounds a bit strange that they're blocking just that one url unless the server is on a blacklist - usually they block ALL external URLs and then they can enable just the ones that you need to access. My point being that a proxy probably won't help you in this case - you need to get your host to enable external access for this script or, if they won't, find another host!

For what it's worth - I've used Aplus.net for my hosting and had no problems getting ports and external URLs enabled - it's a bit of a pain having to go through the process at all, but if it keeps my shared host safe - no problem!

GB2008 is offline   Reply With Quote
Old 07-08-2009, 07:36 PM   #6
Active Warrior
 
Join Date: Jun 2009
Posts: 36
Thanks: 2
Thanked 0 Times in 0 Posts
Default Re: Why i Canot make curl of this url?

you are right gb208 i got another curl problem . when i ask justhost.com they said the said dalas data center has blocking the url .
hotscode is offline   Reply With Quote
Old 07-09-2009, 03:04 AM   #7
Audio & Video Guru
War Room Member
 
Join Date: Nov 2007
Location: Manchester, UK
Posts: 55
Thanks: 0
Thanked 7 Times in 7 Posts
Social Networking View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via AIM to eddiejames Send a message via MSN to eddiejames Send a message via Skype™ to eddiejames
Default Re: Why i Canot make curl of this url?

If the data centre is blocking the URL, I would be very suspicious of having anything to do with that!

Is it some kind or illegal or unwanted content? Be careful... Chances are, if the providers data center is blocking the URL, the content will not be welcome on a server within their network anyway.

Regards,

James (or Eddie)
eddiejames is offline   Reply With Quote
Old 07-09-2009, 04:16 AM   #8
Active Warrior
 
Join Date: Jun 2009
Posts: 36
Thanks: 2
Thanked 0 Times in 0 Posts
Default Re: Why i Canot make curl of this url?

ohh thanks for the information eddiejames.

hotscode is offline   Reply With Quote
Old 07-09-2009, 06:14 AM   #9
Gary
 
GB2008's Avatar
 
Join Date: Jan 2009
Location: Dallas, TX
Posts: 135
Blog Entries: 1
Thanks: 13
Thanked 9 Times in 9 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Skype™ to GB2008
Default Re: Why i Canot make curl of this url?

Don't get too carried away with that being a bad URL just based on this information - in my experience, web hosts block ALL external URL access by default to be on the safe side - good and bad URLs. Try googling the URL you are after, or maybe googling URL blacklists to see if it shows on them and get another opinion before you label it bad.

My feeling is that you just need to have the data center enable connections from your script to the URL(s) you want - they should be able to do that, if their company policy allows for it.

GB2008 is offline   Reply With Quote
Old 07-10-2009, 06:20 AM   #10
Active Warrior
 
Join Date: Jun 2009
Posts: 36
Thanks: 2
Thanked 0 Times in 0 Posts
Default Re: Why i Canot make curl of this url?

thank gb2008 for trying to help me .

hotscode is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
canot, curl, make, url

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 02:25 AM.