Jump to content

Recommended Posts

Hi all,

 

I have written a script that checks whois data for domains and whenever i call the script is gives me this: Warning: parse_url() expects exactly 1 parameter, 2 given in /nfs/c02/h07/mnt/15718/domains/wirrina.com/html/urlwhois.php on line 8

 

It prints no results..

 

This script used to work and then one day it just stopped working?

Is it outdated code made to work on a previous version of PHP?

 

 

Here is the code:

<?php
$url = $_GET["url"];
$urldata = parse_url($url, PHP_URL_HOST);

$finished = str_replace("www.", "", $urldata);
echo '<a href="http://whois.com.au" TARGET="_blank"><img src="http://whois.com.au/images/whoisRED.gif" border="0"></a><br />';
echo "<h1>WHOIS data for ";
echo parse_url($url, PHP_URL_HOST);
echo '</h1><br /><font size="-1" face="Verdana">';

function ae_whois($query, $server)
{

    define('AE_WHOIS_TIMEOUT', 15); // connection timeout
    global $ae_whois_errno, $ae_whois_errstr;

    // connecting 
    $f = fsockopen($server, 43, $ae_whois_errno, $ae_whois_errstr, AE_WHOIS_TIMEOUT);
    if (!$f) 
        return false; // connection failed 

    // sending query    
    fwrite($f, $query."\r\n");

    // receving response 
    $response = '';
    while (!feof($f))
        $response .= fgets($f, 1024);

    // closing connection 
    fclose($f);

    return $response;
}


echo ae_whois($finished, 'whois.internic.net');
echo '</font>';

?>

 

Thanks for the help in advance..

WillSavin

Link to comment
https://forums.phpfreaks.com/topic/142428-parse_url-errors/
Share on other sites

Thanks again!

 

It is returning "Notice: Undefined variable: parsed in C:\wamp\www\urlwhois.php on line 4" with this code:

 

<?php
$url = $_GET["url"];
$parsed = parse_url($url);
$urldata2 = $parsed['host'];
print_r($urldata2);

$finished = str_replace("www.", "", $urldata2);
echo '<a href="http://whois.com.au" TARGET="_blank"><img 

src="http://whois.com.au/images/whoisRED.gif" border="0"></a><br 

/>';
echo "<h1>WHOIS data for ";
echo $urldata2;
echo '</h1><br /><font size="-1" face="Verdana">';

function ae_whois($query, $server)
{

    define('AE_WHOIS_TIMEOUT', 15); // connection timeout
    global $ae_whois_errno, $ae_whois_errstr;

    // connecting 
    $f = fsockopen($server, 43, $ae_whois_errno, 

$ae_whois_errstr, AE_WHOIS_TIMEOUT);
    if (!$f) 
        return false; // connection failed 

    // sending query    
    fwrite($f, $query."\r\n");

    // receving response 
    $response = '';
    while (!feof($f))
        $response .= fgets($f, 1024);

    // closing connection 
    fclose($f);

    return $response;
}


echo ae_whois($finished, 'whois.internic.net');
echo '</font>';

?>

 

WillSavin

Link to comment
https://forums.phpfreaks.com/topic/142428-parse_url-errors/#findComment-747401
Share on other sites


print_r($parsed);

 

That is what I wanted a print_r on, but it is not being set. What type of a URL are you passing to the function? What version of PHP are you using?

 

It seems to me like the url may be causing problems, but I am not sure. Let me know on that and We will go from there.

Link to comment
https://forums.phpfreaks.com/topic/142428-parse_url-errors/#findComment-747605
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.