Warning: fsockopen() [function.fsockopen]: unable to connect

Discussion in 'PHP' started by SimThePhpCoder, Mar 27, 2008.

  1. #1
    I am trying to check if my link is on someones website before adding there link to my website. I get the following error's

    Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.thenarutommorpg.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /mounted-storage/home60b/sub001/sc18478-RGIJ/thenarutommorpg.com/links.php on line 27

    Warning: feof(): supplied argument is not a valid stream resource in /mounted-storage/home60b/sub001/sc18478-RGIJ/thenarutommorpg.com/links.php on line 28


    if(isset($_POST['Submit'])) 
    { 
    
    $title = $_POST['textTitle']; 
    $url = $_POST['textURL']; 
    $descr = $_POST['textDESC']; 
    $return = $_POST['textURL2']; 
    $fp = fsockopen($return, 80, $errno, $errstr, 30); 
    while (!feof($fp)) 
    { 
    $page .= fgets($fp, 128); 
    } 
    if(stristr($page, '<a href="http://www.thenarutommorpg.com"') === TRUE) 
    { 
    $sql = "INSERT INTO links (url, title, descr, return_url) VALUES ('$url', '$title', '$descr', '$return')"; 
    
    if (!($result = $db->sql_query($sql))) 
    { 
    message_die(GENERAL_ERROR, 'Could not insert link information', '', __LINE__, __FILE__, $sql); 
    } 
    
    $template->assign_vars(array('MESSAGE' => "Your Link has been added.")); 
    } 
    else 
    { 
    $template->assign_vars(array('MESSAGE' => "Our link could not be found on the page you supplied; therefor, your link was not added.")); 
    } 
    
    }
    PHP:

     
    SimThePhpCoder, Mar 27, 2008 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    make a php file with <?=phpinfo();?> as the contents, and upload it to your server.

    load it via the web, and you'll see your server settings.

    what your looking for is "Registered PHP Streams" you'll need to make sure that http is listed in it

    if it's not, then your server isn't configured to support it.

    you can get more information at http://au2.php.net/fsockopen

    if it's enabled, we'll take it from there.
     
    powerspike, Mar 28, 2008 IP
  3. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #3
    its not enabled ;\
     
    SimThePhpCoder, Mar 29, 2008 IP