[advanced search]
Results from the most recent live auction are here.
24 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 06-28-2008, 12:59 PM   · #1
combs84
NamePros Regular
 
Name: Jon
Location: Michigan
Trader Rating: (19)
Join Date: Jun 2005
Posts: 517
NP$: 57.00 (Donate)
combs84 is a jewel in the roughcombs84 is a jewel in the roughcombs84 is a jewel in the rough
Quick Help! Parsing

So I made a thread a while back on how to parse a certain link.

This this the coding I am using. There are 2 sets of code.
________________________________________________
<?php

echo file_get_contents('http://www.superbook.com/seo.txt');

?>

_______________________________________________

<?php

echo file_get_contents('http://www.sportsbook.com/seo.txt');

?></ul>

_______________________________________________

That is the exact code i'm using. You can go here: http://www.cavsreport.com/blog/ and scroll down on the left column, and under FRIENDS is where I have it pasted. You can see the first link WORKS. While the 2nd link comes back with an error that says:

Warning: file_get_contents(http://www.sportsbook.com/seo.txt) [function.file-get-contents]: failed to open stream: HTTP request failed! in /homepages/36/d132896813/htdocs/CavsReport/blog/wp-content/themes/reflections/sidebar.php on line 92

My question is..why is this error there? Why does the first coding work, yet the 2nd one fails and gives an error? It does this on every page I put it on. Is it a problem with the actual ad page, even though they are basically the same?


Please register or log-in into NamePros to hide ads
combs84 is offline   Reply With Quote
Old 06-28-2008, 02:02 PM   · #2
Bruce_KD
NamePros Member
 
Trader Rating: (1)
Join Date: Sep 2006
Posts: 78
NP$: 100.00 (Donate)
Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough
Your code on my server works fine.
It almost looks as if your server's IP has been blocked by the other server.

You may want to contact the owner of that server to see if they have any sort of firewall that may have blocked your server.


Bruce
Bruce_KD is offline   Reply With Quote
Old 06-28-2008, 02:20 PM   · #3
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (45)
Join Date: Nov 2003
Posts: 4,178
NP$: 2044.15 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
do you have root access on the server? if you do try accessing the page using lynx via ssh.

I agree with Bruce's assumption and doing this would confirm if there was a problem.

Another possibility is that it is taking too long to load and failling.
Peter is online now   Reply With Quote
Old 06-28-2008, 02:23 PM   · #4
combs84
NamePros Regular
 
Name: Jon
Location: Michigan
Trader Rating: (19)
Join Date: Jun 2005
Posts: 517
NP$: 57.00 (Donate)
combs84 is a jewel in the roughcombs84 is a jewel in the roughcombs84 is a jewel in the rough
Wow, I think you're right. That's for checkin that for me. It did would fine on my other site that isn't on those 1and1 servers.

And about root, I can access it using SSh yea. But then what do I do?

Is there a way I can fix this personally without contact my 1and1 server people who leave me on hold for 3 hours and then can't speak english?

Last edited by combs84 : 06-28-2008 at 02:27 PM.
combs84 is offline   Reply With Quote
Old 06-28-2008, 02:40 PM   · #5
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (45)
Join Date: Nov 2003
Posts: 4,178
NP$: 2044.15 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
providing lynx is installed try:-

lynx http://www.sportsbook.com/seo.txt

see what response you get.if your ip is blocked there is nothing you can do bar changing your ip. It could also be a dns issue.
Peter is online now   Reply With Quote
Old 06-29-2008, 06:59 AM   · #6
blacknet
NamePros Member
 
Trader Rating: (17)
Join Date: May 2008
Posts: 178
NP$: 85.00 (Donate)
blacknet is just really niceblacknet is just really niceblacknet is just really niceblacknet is just really niceblacknet is just really nice
Very Swiftly,

The response is being blocked because they have bot / script detection on the site, to get around this you need to send the HTTP Headers a normal web browser would send.

Give this a go, should work for you

PHP Code:
<?php
function createContext() {
    
$headerstrings = array();
    
$headerstrings['User-Agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.'.rand(0,2).'; en-US; rv:1.'.rand(2,9).'.'.rand(0,4).'.'.rand(1,9).') Gecko/2007'.rand(10,12).rand(10,30).' Firefox/2.0.'.rand(0,1).'.'.rand(1,9);
    
$headerstrings['Accept-Charset'] = rand(0,1) ? 'en-gb,en;q=0.'.rand(3,8) : 'en-us,en;q=0.'.rand(3,8);
    
$headerstrings['Accept-Language'] = 'en-us,en;q=0.'.rand(4,6);
    
$setHeaders =     'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'."\r\n".
                    
'Accept-Charset: '.$headerstrings['Accept-Charset']."\r\n".
                    
'Accept-Language: '.$headerstrings['Accept-Language']."\r\n".
                    
'User-Agent: '.$headerstrings['User-Agent']."\r\n";
    
$contextOptions = array(
        
'http'=>array(
            
'method'=>"GET",
            
'header'=>$setHeaders
        
)
    );
    return
stream_context_create($contextOptions);
}

echo
file_get_contents( 'http://www.sportsbook.com/seo.txt' , false , createContext() );
?>
blacknet is offline   Reply With Quote
Reply

NamePros is a revenue sharing forum.

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Find out how! Buy Flash Arcade Game Script Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 02:52 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0