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.

1 Answer 1

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();
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.