Questions tagged [get-headers]
90 questions
2
votes
1 answer
Woocommerce API PHP Response Header
I cannot seem to find a way to access the X-WP-TotalPages in the header of the response, I am able to display my orders and everything the way I want to but for the life of me cannot figure out how to get to the headers in the response.
I am using…

Jay the Geek
- 83
- 1
- 11
2
votes
1 answer
PHP - get_headers() return wrong result when non-UTF symbols are in URL
I stumbled upon the wrong result of get_headers() method.
URL for testing: http://www.zakon.hr/z/199/Zakon-o-elektroni%C4%8Dkoj-trgovini
Here's simple curl request to that URL:
As you can see on screenshot there's successful response with 200 OK…

Limon Monte
- 52,539
- 45
- 182
- 213
2
votes
0 answers
How to extract Google Search results redirect URLs using PHP
I need a way for PHP to extract the FIRST result's URL from google search results page but I need the Redirect URL.
The search query:
https://www.google.com/search?site=&source=hp&q=what%27s+new+in+windows+phone
I need this link:…

Zain
- 21
- 3
2
votes
2 answers
Include external code on a web page ( php include() or get_header() )
I've started creating a custom html page for the first time and i've hit a bump. The code in the header will be the same in all my pages , so i want to put it in an external file (header.php) and just put 1 line of code in all my pages to link to it…

John_Nil
- 165
- 2
- 4
- 17
2
votes
1 answer
php check if file exists on an external doman (accessing form a sub domain)
I have a website on http://www.reelfilmlocations.co.uk
The above site has an admin area where images are uploaded and different size copies created in subfolders of an uploads/images directory.
I am creating a site for mobile devices, which will…

Dizzy Bryan High
- 2,015
- 9
- 38
- 61
2
votes
2 answers
get_headers() on Gravatar returning 200 instead of 404
I'm passing a URL that should generate a 404 Error, using PHP's get_headers(). In fact, if I use the URL as a link, I get a 404 Error in my browser. And if I use the URL (which is to an image file) as an img src the "Network" tab of my browser shows…

Tom Auger
- 19,421
- 22
- 81
- 104
2
votes
0 answers
What environment change causes get_header to return a different output?
like the title states I'm running the same script on two different PHP versions.
My Server 1- 5.2.17
My Server 2- 5.3.19
get_headers($url, 1);
$url was google (no www) with http and .co.uk - Or use any url that returns a 404
An example of the…

A.B
- 21
- 2
2
votes
2 answers
php get_headers exception handling
I am running the following command and getting an exception:
$headers = get_headers("http://www.moneysupermarket.com/mortgages/", 1);
How do I handle this exception (in my case, ignore this url as it is causing an exception).
I have…

jagku
- 309
- 3
- 14
2
votes
2 answers
how to insert header or footer to a word document using c++ automation
I want to insert a header or footer in a word document using word automation.
_document ocDoc;
Sections DocSections = Sections(ocDoc.GetSections());
section firstSec = DocSections.Item( 1 );
HeaderFooter Hf = firstSec.GetHeaders();
Range MyRange =…

amir hajizadeh
- 125
- 11
1
vote
3 answers
php get_headers a good way to tell if a site is up?
I'm still fairly new to php, can you comment on whether the code below is any good to tell if a site is up or down and if it might not be suitable the reasons why and better altneratives?
Thanks in advance.
$siteHeader = @get_headers($url , 1);
if…

Ben Paton
- 1,432
- 9
- 35
- 59
1
vote
0 answers
Check IMG URL status (PHP get_headers)
In a nut-shell, I am trying to display feeds from other sites, that sometimes have IMG elements. Ideally, these IMG should be loaded by an external proxy, such as Aratech or Weserv. In my code below, I am trying to use Weserv. Then, if this is not…

Gadgets Mall
- 53
- 8
1
vote
1 answer
Local Node (Geth) failed to sync from TestNet
Dear all Blockchain experts,
I have created a local node by using Geth, this is the startup command.
geth --testnet --rpc --rpcaddr "localhost" --rpcport "8545" --rpcapi "web3,eth,net,personal" --rpccorsdomain "*" --datadir "./data" --identity…

DavidB
- 313
- 1
- 8
- 23
1
vote
2 answers
PHP - get_header throws error: Filename cannot be empty
This is whole code I'm using which works on some other sites, but on google does not and throws me an error:
$url = 'http://www.google.com';
$sitemap = $url.'/sitemap.xml';
$robots = $url.'/robots.txt';
$robotsx = [$sitemap, $robots];
$sitemaps…

codexy
- 413
- 1
- 5
- 18
1
vote
2 answers
get_headers Connection time out
I get this error message: get_headers failed to open stream: Connection timeout
Here is the code:
$file_headers = @get_headers('http://www.example.fr');
print_r(get_headers('http://www.example.fr'));
if ( strpos( $file_headers[0], "200" )) {
…

Ayoub Bsl
- 159
- 2
- 6
- 14
1
vote
2 answers
PHP - for get_headers($url, 1), are the keys for status codes *always* integers?
Looking at the PHP docs for get_headers()...
array get_headers ( string $url [, int $format = 0 ] )
... there are two ways to run it:
#1 (format === 0)
$headers = get_headers($url);
// or
$headers = get_headers($url, 0);
#2 (format !==…

Birrel
- 4,754
- 6
- 38
- 74