I coding a PHP script that has to check if exists a GitHub repo that the user enters. But I don’t know how can I do it. I think the main matter is to know which HTTP code gives GitHub, but I can’t find anything like that in cURL PHP documentation. How can I do it?
Share
HTTP in istelf is a rather simple protocol, so just check if you get a 404. That’d mean it doesn’t exist. As an alternative to cURL, you might want to consider using get_headers, that’s less intensive to write.