dsbpac Posted December 20, 2012 Share Posted December 20, 2012 I was able to create a cURL code that pulls all the content from a website. I have a 3rd party page that outputs one of the following two codes depending on if the CC is accepted or declined. <div id="[url=""]response_div[/url]" class="[url=""]webpay[/url]"> <span id="[url=""]response_label[/url]" class="[url=""]webpay[/url]">Response:</span> <span id="[url=""]response_value[/url]" class="[url=""]webpay[/url]">AVSSALE:TEST:::257943997:N::U</span> </div> <div id="[url=""]reason_div[/url]" class="[url=""]webpay[/url]"> <span id="[url=""]reason_label[/url]" class="[url=""]webpay[/url]">Reason:</span> <span id="[url=""]reason_value[/url]" class="[url=""]webpay[/url]">DECLINED:0720990009:CARD NO. ERROR:14</span> </div> How can I make a search_for_string to search for that variable and based on that, it returns a result? This is my current code to pull all the information from the 3rd party site. <?php $ch = curl_init ("http://www.mypage.com"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $mypage = curl_exec ($ch); echo "$mypage"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/272205-curl-search-for-specific-variable/ Share on other sites More sharing options...
Jessica Posted December 20, 2012 Share Posted December 20, 2012 This has nothing to do with cURL. It depends what you're searching for. You'd either use a DOM Parser, or just simple strpos type functions. Quote Link to comment https://forums.phpfreaks.com/topic/272205-curl-search-for-specific-variable/#findComment-1400520 Share on other sites More sharing options...
dsbpac Posted December 20, 2012 Author Share Posted December 20, 2012 Thank you so much for pointing me in the write direction. I'm using strpos function to return a result and do an action. TYVM Quote Link to comment https://forums.phpfreaks.com/topic/272205-curl-search-for-specific-variable/#findComment-1400522 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.