Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:29:22+00:00 2026-06-02T21:29:22+00:00

Consider the following: $url = ‘http://psyng.com/u/9716602b’; $headers = get_headers($url, 1); print_r($headers); Since the domain

  • 0

Consider the following:

$url = 'http://psyng.com/u/9716602b';
$headers = get_headers($url, 1);
print_r($headers);

Since the domain psyng.com is unresolvable, this code results in:

Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: 
No such host is known

And then the script stops running. Is there a way to keep the rest of the script running – in other words: to catch the error, and move forward with resolving the next URL? So something like:

$url = 'http://psyng.com/u/9716602b';
$headers = get_headers($url, 1);
if ($headers == 'No such host is known') {
  // nevermind, just move on to the next URL in the list...
}
else {
  // resolve header stuff...
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:29:24+00:00Added an answer on June 2, 2026 at 9:29 pm

    The script shouldn’t stop running as the message produced is just a warning. I tested this script myself and that’s the behaviour I see. You can see in the documentation that get_headers() will return FALSE on failure so your condition should actually be

    if ($headers === FALSE) {
        // nevermind, just move on to the next URL in the list...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following Python code: 30 url = http://www.google.com/search?hl=en&safe=off&q=Monkey 31 url_object = urllib.request.urlopen(url); 32
consider following url: http://sitename.com/School/Admin/PageViewer i have a subfolder in School named UserFiles that contains
Consider the following URLs http://m3u.com/tunein.m3u http://asxsomeurl.com/listen.asx:8024 http://www.plssomeotherurl.com/station.pls?id=111 http://22.198.133.16:8024 Whats the proper way to determine
Please consider the following URLs: http://www.mydomain.com/a/test.php https://www.mydomain.org/a/b/test.php http://www.mydomain.co.nr/a/b/c/test.php https://www.mydomain.com/a/b/c/d/test.php http://www.mydomain.co.uk/a/b/c/d/e/test.php https://www.mydomain.co.au.nm/a/b/c/d/e/f/test.php?var1=test1&var2=test2 Now I want
Consider following two examples: Example 1: <xs:import namespace=http://example.com/ns schemaLocation=test.xsd/> Example2: <sample:Data Test=true xsi:schemaLocation=http://example.com/test.xsd> How
Consider the following XML: <response> <status_code>200</status_code> <status_txt>OK</status_txt> <data> <url>http://bit.ly/b47LVi</url> <hash>b47LVi</hash> <global_hash>9EJa3m</global_hash> <long_url>http://www.tumblr.com/docs/en/api#api_write</long_url> <new_hash>0</new_hash> </data>
Consider the following PHP cURL command: $url = 'http://bit.ly/faV1vd'; $_h = curl_init(); curl_setopt($_h, CURLOPT_HEADER,
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider following: $(#myform).attr({ action: @Url.Action(MVC.Thing.Delete().AddRouteValue(id, myJsModel.Id )) }); I'm trying to set the action
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.