The no-CURL way to submit a request to Tenon API

A few months ago, I posted Tutorial: Creating a PHP class to use with Tenon.io. Someone asked me “What about servers that don’t have CURL? Here you go. Use the class in that post, but swap out the submit() function for this:

function submit(){

    $content = http_build_query($this->opts);

    $options = array(
        'http' => array(
            'method' => 'POST',
            'content' => $content
	));

    $context = stream_context_create($options);
    $this->tenonResponse = file_get_contents($this->url, false, $context);
}

In fact, using streams may even be faster than CURL!

If you are interested in learning about the next generation in Web Accessibility Testing, give Tenon.io a try.
If you or your organization need help with accessibility consulting, strategy, or accessible web development, email me directly at karl@karlgroves.com or call me at +1 443-875-7343. Download Resume [MS Word]

Post a Comment