{"id":147,"date":"2016-03-13T00:27:42","date_gmt":"2016-03-12T23:27:42","guid":{"rendered":"http:\/\/lab.fawno.com\/?p=147"},"modified":"2022-03-07T01:28:49","modified_gmt":"2022-03-07T00:28:49","slug":"","status":"publish","type":"post","link":"https:\/\/lab.fawno.com\/en\/2016\/03\/13\/truco-express-extraer-dominio-de-un-email\/","title":{"rendered":"","raw":""},"content":{"rendered":"","protected":false,"raw":""},"excerpt":{"rendered":"","protected":false,"raw":""},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_editorskit_title_hidden":false,"_editorskit_reading_time":1,"_editorskit_typography_data":[],"_editorskit_blocks_typography":"","_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_es_post_content":"\n

Para extraer el dominio de una direcci\u00f3n de email podemos utilizar var\u00edas t\u00e9cnicas, sin embargo la m\u00e1s sencilla es utilizar la funci\u00f3n parse_url<\/a>:<\/p>\n\n\n\n

$email = 'user@example.com';\n$parts = parse_url('email:\/\/' . $email);<\/pre>\n\n\n\n

El resultado obtenido es un array con los componentes:<\/p>\n\n\n\n

Array (\n  [scheme] => email\n  [host] => example.com\n  [user] => user\n)<\/pre>\n\n\n\n

Evidentemente parse_url<\/em> no valida la direcci\u00f3n de email, es decir, no sirve para comprobar que la direcci\u00f3n sea correcta. Para esto lo normal es utilizar una expresi\u00f3n regular... pero eso es otro truco para otro d\u00eda.<\/p>\n","_es_post_name":"truco-express-extraer-dominio-de-un-email","_es_post_excerpt":"","_es_post_title":"Truco express: extraer dominio de un email","_en_post_content":"","_en_post_name":"","_en_post_excerpt":"","_en_post_title":"","edit_language":"en","footnotes":""},"categories":[5,3],"tags":[6],"class_list":["post-147","post","type-post","status-publish","format-standard","hentry","category-php","category-tips","tag-php"],"ninja_gutenberg_blocks_featured_media_urls":{"thumbnail":"","ninja_gutenberg_blocks_landscape_large":"","ninja_gutenberg_blocks_portrait_large":"","ninja_gutenberg_blocks_square_large":"","ninja_gutenberg_blocks_landscape":"","ninja_gutenberg_blocks_portrait":"","ninja_gutenberg_blocks_square":"","full":""},"_links":{"self":[{"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/posts\/147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/comments?post=147"}],"version-history":[{"count":6,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/posts\/147\/revisions"}],"predecessor-version":[{"id":1857,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/posts\/147\/revisions\/1857"}],"wp:attachment":[{"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/media?parent=147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/categories?post=147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.fawno.com\/en\/wp-json\/wp\/v2\/tags?post=147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}