trampolinejoe Posted March 4, 2009 Share Posted March 4, 2009 Hey Guys, I need to do the following, I need to: a) post a form to another domain, b) grab the contents of the result of that domain c) set it to a variable without leaving the page I have no idea at all where to start. Please help. Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/ Share on other sites More sharing options...
WolfRage Posted March 4, 2009 Share Posted March 4, 2009 OK so I fixed my code from earlier, I was calling the wrong function. To pass data you just change the array $data to accommodate your variables and their values. <?php $data = array ('foo' => 'bar', 'bar' => 'baz'); $data = http_build_query($data); $context_options = array ( 'http' => array ( 'method' => 'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n", 'content' => $data ) ); $context = stream_context_create($context_options) $fp = file_get_contents('https://url', FALSE, $context); ?> Now try grabbing the page and do a var_dump() on $fp see if that spits out the information for the page if it does then you just have to isolate the fingerprint and you can do whatever you need to from there. Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/#findComment-776213 Share on other sites More sharing options...
trampolinejoe Posted March 4, 2009 Author Share Posted March 4, 2009 G'day Wolf! Good to see you again! I have it so close to working now! ok, now! to finsh it off I need to be able to post the following variables to the page so that it can create the key. <input type="hidden" name="EPS_TIMESTAMP" value="<?php echo $timestamp; ?>"> <input type="hidden" name="EPS_MERCHANT" value="ID893240"> <input type="hidden" name="EPS_PASSWORD" value="XXXX"> <input type="hidden" name="EPS_REFERENCEID" value="<?php echo $referenceid; ?>"> <input type="hidden" name="EPS_AMOUNT" value="<?php echo $amount; ?>"> Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/#findComment-776230 Share on other sites More sharing options...
trampolinejoe Posted March 4, 2009 Author Share Posted March 4, 2009 ok, all finshed! working 100% Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/#findComment-776238 Share on other sites More sharing options...
trampolinejoe Posted March 4, 2009 Author Share Posted March 4, 2009 oh, I forgot to thank you.. Thanks Wolf! Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/#findComment-776239 Share on other sites More sharing options...
WolfRage Posted March 4, 2009 Share Posted March 4, 2009 Hey no problem man. I was working on it too, just now. Disregard the post requesting the code, I got it working once I pluged it into my localhost and tried it out. Link to comment https://forums.phpfreaks.com/topic/147884-solved-get-value-of-page-from-another-url/#findComment-776242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.