leesiulung Posted August 17, 2007 Share Posted August 17, 2007 Is there a way to send a GET request via PHP code? I need to send it to a url as follows: http://www.mydomain.com/index.asp?email=emailaddress The following is disabled: getmyinode, getopt, getrusage, extension_loaded, dl, mysql_pconnect, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, pfsockopen, mysql_list_dbs, mysql_stat, ini_get, ini_get_all, ini_alter, ini_set, get_current_user, get_defined_constants, get_include_path, php_ini_scanned_files, php_uname, phpcredits, restore_include_path, set_include_path, set_time_limit, version_compare, zend_version, getmypid, getmyuid, getmygid, assert_options, assert, fopen, fwrite, fread, file, fpassthru, file, mail, opendir, readdir, closedir I'm on PHP4 on Windows. I cannot use curl with the following code: <?php $ch = curl_init('http://www.mysite.com/index.php?option=com_content&task=blogcategory&id=24&Itemid=55'); curl_exec ($ch); curl_close ($ch); ?> This suggest that I cannot use curl and is a limitation of my hosting company, GoDaddy.... Any programmers want to take me on the challenge and help me out? Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/ Share on other sites More sharing options...
trq Posted August 17, 2007 Share Posted August 17, 2007 Do you have access to the socket functions? Without that or curl your foobar'd. Pay for cheap hosting, get a cheap host. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326457 Share on other sites More sharing options...
leesiulung Posted August 17, 2007 Author Share Posted August 17, 2007 I'm not sure what socket function you are talking about? I do not see this socket function as part of the disabled list I provided. I grabbed this list of phpinfo();. Unfortunately, PHP hosting with Windows at GoDaddy leaves a lot to be desired. PHP on Linux does not support MS Access. MS Access support and PHP was a requirement.... Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326482 Share on other sites More sharing options...
d.shankar Posted August 17, 2007 Share Posted August 17, 2007 <?php header("Location:http://www.mydomain.com/index.asp?email=emailaddress"); ?> I hope it works ! Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326490 Share on other sites More sharing options...
leesiulung Posted August 17, 2007 Author Share Posted August 17, 2007 <?php header("Location:http://www.mydomain.com/index.asp?email=emailaddress"); ?> I hope it works ! Unfortunately, that does not work because it would redirect the browser to a different page too. I need it to silently make the GET or POST in the background. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326492 Share on other sites More sharing options...
d.shankar Posted August 17, 2007 Share Posted August 17, 2007 You can use this then.. <?php $ch = curl_init('http://www.mysite.com/index.php?option=com_content&task=blogcategory&id=24&Itemid=55'); curl_exec ($ch); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "email=emailaddress"); curl_close ($ch); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326494 Share on other sites More sharing options...
leesiulung Posted August 17, 2007 Author Share Posted August 17, 2007 curl do not seem to work with the server. Everytime I try to run curl_init() it always returns nothing (printed out on screen). I think this is equivalent of false. Since I do not see error messages (turned off and unable to turn on), I have no idea what is wrong. Any other suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326861 Share on other sites More sharing options...
Azu Posted August 17, 2007 Share Posted August 17, 2007 Does fopen work for you? Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326978 Share on other sites More sharing options...
nathanmaxsonadil Posted August 17, 2007 Share Posted August 17, 2007 a good free host is igotfree.com if you have a domain Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-326988 Share on other sites More sharing options...
leesiulung Posted August 17, 2007 Author Share Posted August 17, 2007 Does fopen work for you? I do not see fopen in the list of disabled functions. Do you mind posting a little code to save me a few hours of reading the help file and trying it out? a good free host is igotfree.com if you have a domain I'm stuck with godaddy. I just did not realize that their Windows hosting was that limited.... Dedicated or even virtual dedicated server would be best. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327113 Share on other sites More sharing options...
Barand Posted August 17, 2007 Share Posted August 17, 2007 How about an xmlhttp request? Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327171 Share on other sites More sharing options...
tibberous Posted August 17, 2007 Share Posted August 17, 2007 Wow, you have the worst host ever. Use bluehost, there good guys - sat on the phone with me for 40 minutes getting Tidy to work. Cheap ($100/year), great packages (server is a little slow) - bluehost.com Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327202 Share on other sites More sharing options...
leesiulung Posted August 18, 2007 Author Share Posted August 18, 2007 How about an xmlhttp request? That would work, but that means the client "can" know what I'm sending in the GET/POST since it would have the GET/POST data has to be sent to the client and then from the client back to the server. I might have to just use a different scripting language... It seems like this is an impossible challenge.... Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327230 Share on other sites More sharing options...
trq Posted August 18, 2007 Share Posted August 18, 2007 I might have to just use a different scripting language... It seems like this is an impossible challenge.... The fact is that php is capable of such functionality, just that your host seems to have disabled most of it. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327232 Share on other sites More sharing options...
Azu Posted August 18, 2007 Share Posted August 18, 2007 $a=stream_get_contents(fopen('http://www.google.com/','rb')); Would make $a= the contents of google.com fopen('http://www.google.com/','rb'); would send a request to google.com, but wouldn't actually download it. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-327602 Share on other sites More sharing options...
leesiulung Posted August 23, 2007 Author Share Posted August 23, 2007 To those trying with the same issue with GoDaddy hosting, my solution ended up being to use an ASP page and post the information to this page. On errors, I would send a GET message back to the original PHP script. As far as I know, PHP at GoDaddy is running on Safe Mode and is not officially supported on Windows platform. It also does not display errors in PHP scripts, even when you try to enable them in code. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-332165 Share on other sites More sharing options...
dbo Posted April 5, 2008 Share Posted April 5, 2008 GoDaddy allows you to create your own php.ini files. Doesn't that eliminate a lot of the headaches listed in the thread? Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-510064 Share on other sites More sharing options...
darkhappy Posted June 22, 2008 Share Posted June 22, 2008 i use godaddy with the linux package and i get all the normal functions. it is just slow sometimes. Quote Link to comment https://forums.phpfreaks.com/topic/65371-challenge-sending-get-request-in-php-code/#findComment-571837 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.