2

hii this is my php code fore get status on url.

 $client = new Client();
        $url_to_traverse = 'http://wordcomat.com';
        $crawler = $client->request('GET', $url_to_traverse);
        $status_code = $client->getResponse()->getStatus();

but i try to found status code of facebook it's not return any thing.

 $client = new Client();
        $url_to_traverse = 'http://www.facebook.com';

        $crawler = $client->request('GET', $url_to_traverse);
        $status_code = $client->getResponse()->getStatus();

twitter not working.

 $client = new Client();
        $url_to_traverse = 'http://www.twitter.com';

        $crawler = $client->request('GET', $url_to_traverse);
        $status_code = $client->getResponse()->getStatus();

facebook or twitter or linkedin or google is not return any thing but not return any error or warning how can i got status of that links.

thank you.

Jakub Zalas
  • 35,761
  • 9
  • 93
  • 125
Renish Khunt
  • 5,620
  • 18
  • 55
  • 92

1 Answers1

5

thy are using https protocol
try the following

    $client = new Client();
    $url_to_traverse = 'https://www.facebook.com';

    $crawler = $client->request('GET', $url_to_traverse);
    $status_code = $client->getResponse()->getStatus();
Anri
  • 1,706
  • 2
  • 17
  • 36