EchoFool Posted March 2, 2010 Share Posted March 2, 2010 Hey, I have a row of codes which i want to check on an external page exists in some kind of loop using CURL. How ever the only way to obtain the codes on the external website is to be on index.php with POST name "showtype" set to 1. Otherwise they will not load the list. Can some one explain how i load up such a page with a set POST on my site with CURL to check if the code exists based on the value from my array?? Hope you can help. Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/ Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 http://curl.haxx.se/libcurl/php/examples/simplepost.html This site will be your friend when learning curl, and even after you think you've learned it. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020269 Share on other sites More sharing options...
EchoFool Posted March 2, 2010 Author Share Posted March 2, 2010 Okay i got that but i have to be logged in on the external site which involves a different page to login first =/ Even though im logged in on my browser - how come CURL doesn't act like im logged in ? IS there some thing im missing here. Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020270 Share on other sites More sharing options...
EchoFool Posted March 2, 2010 Author Share Posted March 2, 2010 This is what i tried but i don't know what half of it does. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); // no idea what this is curl_setopt($ch, CURLOPT_URL,"http://www.mydomain.com/?c=login"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "username=user1&password=test12&login=1&redir=1"); ob_start(); // prevent any output curl_exec ($ch); // execute the curl command ob_end_clean(); // stop preventing output curl_close ($ch); unset($ch); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // no idea what this is curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName"); // no idea what this is curl_setopt($ch, CURLOPT_URL,"http://www.domain.com/subfolder/index.php"); //here i need to send a secondary POST to get the list which i mentioned in my original first post! $buf2 = curl_exec ($ch); curl_close ($ch); echo "<PRE>".htmlentities($buf2); ?> Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020276 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); // no idea what this is The name and location of the cookie sent by the site so curl can use it. curl_setopt($ch, CURLOPT_URL,"http://www.domain.com/subfolder/index.php"); //here i need to send a secondary POST to get the list which i mentioned in my original first post! Here is where you have to use the parts from the post example. For any OPTS you dont understand do a bit of rtm'ing. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020278 Share on other sites More sharing options...
EchoFool Posted March 2, 2010 Author Share Posted March 2, 2010 how would i know the location and name of the cookie for a particular site :S Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020280 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 Do a google "IE where are my cookies" "firefox where are my cookies" HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020291 Share on other sites More sharing options...
EchoFool Posted March 2, 2010 Author Share Posted March 2, 2010 lol okay i get the idea - don't ask for help just google although google was what brought me here but never mind. Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020524 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 No, not at all. I have no idea what browser you use or what version it is. You however do, or at least should. So in the time it takes you to post the question you could google and have the answer. Then after that you may have a relevant question like: I use the latest firefox and it uses sqllite to store cookie...what do I do now?? HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193860-check-page-for-value/#findComment-1020533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.