Jump to content

Advanced file_get_contents(); or something to store a GET method data


karthikeyan_coder

Recommended Posts

Hello,

 

Let us say i am getting an url in file_get_contents();

 

$url = "http://Mydomain.com";

 

that site generates a "key" value every time we visit.

 

once you type mydomain.com in browser then it will change it like "mydomain.com/?mykey=akey-31243-and-4232"

 

i need to store this mykey value.

 

how can we do this with file_get_contents or some other technology like cURL...

 

Any help?

I had some success with the following...

$ch = curl_init();
   
    $url ="http://www.php.net/curl_setopt";

    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
    
    $result = curl_exec($ch);
    $url_actual = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);     
    curl_close($ch);
     
              
echo ($url_actual); //for me it echo's http://au.php.net/curl_setopt but it will depend your location

I'm not 100% sure this will apply to your situation but give it a go.

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.