anthonyiacono Posted April 6, 2008 Share Posted April 6, 2008 Hey, I am trying to write a script to retrieve values from a webpage's source code, but in order to get there I need to fake a POST with the correct data to authenticate myself, this is what I have right now: <?php // First Etology $fp=pfsockopen("https://etology.com",80); if($fp) { echo("Etology connection open...<br />\n"); // Login by faking the process. $data="loginUserName=SOMEUSERNAME&loginPassword=SOMEPASSWORD\r\n"; $data=urlencode($data); $header = 'POST /user-signup.php HTTP/1.0\r\n'; $header.= 'HOST: etology.com\r\n'; $header .= 'Content-Type: application/x-www-form-urlencoded\r\n'; $header .= 'Content-Length: ' . strlen($data) . '\r\nUser-Agent: Mozilla\r\n\r\n'; echo("Sending data...<br />\n"); fputs($fp,$header); echo("Done sending.<br />\n"); // Read data $header = 'GET /selling-statistic-payment.php HTTP/1.0\r\n'; $header.= 'HOST: etology.com\r\n'; $header.= 'User-Agent: Mozilla\r\n\r\n'; fputs($fp,$header); while(!feof($fp)) { $info=fgets($fp); } echo($info); // Close connection. fclose($fp); } ?> But when I do this I get: Warning: pfsockopen() [function.pfsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/aiacono/public_html/boltradio/get_ads.php on line 3 Warning: pfsockopen() [function.pfsockopen]: unable to connect to https://etology.com:80 in /home/aiacono/public_html/boltradio/get_ads.php on line 3 Any ideas? Link to comment https://forums.phpfreaks.com/topic/99835-sockets-help/ Share on other sites More sharing options...
marklarah Posted April 6, 2008 Share Posted April 6, 2008 post get_ads.php Link to comment https://forums.phpfreaks.com/topic/99835-sockets-help/#findComment-510607 Share on other sites More sharing options...
anthonyiacono Posted April 6, 2008 Author Share Posted April 6, 2008 That is get_ads.php Link to comment https://forums.phpfreaks.com/topic/99835-sockets-help/#findComment-510665 Share on other sites More sharing options...
marklarah Posted April 6, 2008 Share Posted April 6, 2008 Ah. Lets look at line 3 then. I don't really use these port thingys (sounds like i know) But try using the full domain $fp=pfsockopen("https://www.etology.com",80); See if that works. And try http, im not sure if 80 works over http i think it may be a different port, then again im not sure. Link to comment https://forums.phpfreaks.com/topic/99835-sockets-help/#findComment-510819 Share on other sites More sharing options...
marklarah Posted April 6, 2008 Share Posted April 6, 2008 A quick google search shows that its port 443, but still I don't really know. Link to comment https://forums.phpfreaks.com/topic/99835-sockets-help/#findComment-510820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.