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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.