Note that there are some explanatory texts on larger screens.

plurals
  1. POCURL not working to grab HTML content
    text
    copied!<p>I have a CMS at one URL and at least 68 property sites running off that CMS each at different domains.</p> <p>I am trying to grab a form from one of the property sites to display in a modal in the CMS (to allow other properties to see the form to decide if they want to include it as well.)</p> <p>On the bootstrap page, I have this script:</p> <pre><code>(function() { $(document).on('click', '.btnModal', function(e){ e.preventDefault(); var formID = $(this).data('form'); $.ajax({ url: "&lt;?= site_url('staffer/get_form_modal'); ?&gt;", type: "POST", data: { fid: formID }, success: function(msg){ $('#modal-body').html(msg); $('#myModal').modal('show'); } // end success }); }); })(); // end self-invoking anonymous function </code></pre> <p>In the controller, this is the CURL code:</p> <pre><code>public function get_form_modal($fid = null){ if(!$fid){ $fid = $this-&gt;input-&gt;post('fid'); } $form = $this-&gt;istaff_m-&gt;get_modal_form($fid); $html = ''; $url = $this-&gt;boilerplate['propertyInfo'][0]['istaffURL'] . 'staff/' . $form[0]-&gt;URL; // $url echos http://istaff.edrtest.com/staff/res_lr $url = (string) trim(strip_tags($url)); $url = str_replace('&amp;amp;', '&amp;', $url); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result= curl_exec ($ch); if( $result === false){ echo "Curl error: " . @curl_error($ch); } // end if curl_close ($ch); echo $result; } // end get_form_modal function /*-----------------------------------------------------*/ </code></pre> <p>The modal pops up with its header and an empty body. No error message ... just blank.</p> <p>Firebug shows the form ID being posted and an empty response -- again, no error message.</p> <p>Any help is appreciated!</p> <p>UPDATE: Using SSH on the server, I ran 'curl -I '<a href="http://istaff.edrtest.com/staff/res_lr" rel="nofollow">http://istaff.edrtest.com/staff/res_lr</a>' and got back the following:</p> <pre><code>HTTP/1.1 200 OK Server: nginx Date: Mon, 16 Dec 2013 16:15:56 GMT Content-Type: text/html Connection: keep-alive Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Refresh: 0;url=http://istaff.edrtest.com/user/log_in Set-Cookie: PHPSESSID=kbc674bc07nn4aeh2k5rsur685; path=/ X-Powered-By: PleskLin </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload