Jump to content

how can i automatically redirect people to a unique url given in an api response


jamied

Recommended Posts

I am working with an api that gives this response in this format each time it is called:

>     OK|*random sequence of numbers*|http://response.com/0/123456

How can i automatically redirect people to response.com url?

Below is the current PHP script i am using

    <?php

    $url = 'http://example.com/api/';
 
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    $result = curl_exec($ch);

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.